/** * Builds a monitor map with a capacity of 100 references. */ public MonitorMap () { super(); this.map = new Cache(); }
/** * Returns a monitor (to use with a 'synchronized' keyword) for a given * identifier. */ public synchronized Object getMonitor (final Object identifier) { Object monitor = this.map.get(identifier); if (monitor == null) { monitor = new Object(); this.map.put(identifier, monitor); } return monitor; }
/** * Returns the current size of the cache or null if the caching * of XML documents is disabled. */ protected int cacheSize () { if (this.cache == null) return -1; return this.cache.size(); }
/** * Puts the document and its info into the cache. * If caching is disabled, nothing will get done. */ protected void putInCache (final String key, final long lastModified, final org.jdom.Document doc) { if (this.cache == null) return; this.cache.put (key, new DocumentEntry(key, lastModified, doc)); }
/** * Raw get from the cache. * If caching is disabled, will immediately return null. */ protected DocumentEntry getFromCache (final String key) { if (this.cache == null) return null; return (DocumentEntry)this.cache.get(key); }
public void cancel (final CancelItem ci) throws StoreException { final FlowExpressionId id = ci.getId(); this.cache.remove(id); this.cachedHeaders = null; removeWorkItem(id); }
public org.jdom.Element getStatus () { org.jdom.Element result = super.getStatus(); result.addContent(this.cache.getStatus()); return result; }
/** * Stores the flow expression (as it may have changed). */ public void update (final FlowExpression fe) throws PoolException { //log.debug("update() "+fe.getId()); this.cache.put(fe.getId(), fe); //log.debug("update() put in cache"); super.update(fe); //log.debug("update() super.update()..."); }
AbstractWorkItemStore.this.cache.remove(itemId); AbstractWorkItemStore.this.cachedHeaders = null;
/** * Fetches the root environement tied to the engine. */ public Environment fetchEngineEnvironment () { Environment result = (Environment)this.cache.get(EngineEnvironmentId.ID); if (result != null) return result; result = super.fetchEngineEnvironment(); this.cache.put(EngineEnvironmentId.ID, result); return result; }
/** * Usually called by WorkflowInstanceBuilders to add a freshly created * expression to the pool. */ public void add (final FlowExpression fe) throws PoolException { this.cache.put(fe.getId(), fe); super.add(fe); }
/** * Builds a monitor map with a given capacity. */ public MonitorMap (final int cacheSize) { super(); this.map = new Cache(cacheSize); }
/** * Removes a flow expression : * - removes it from cache; * - removes it from store (disk or db) * * This method is called by the replyToFather method, as the * expression tree gets diminished. */ public /*synchronized*/ void removeExpression (final FlowExpression fe) { //log.debug("removeExpression() is fe null ? "+(fe == null)); this.cache.remove(fe.getId()); super.removeExpression(fe); }
/** * Retrieves an expression from the pool. * If the expression cannot be retrieved from the pool, null will be * returned. */ public /*synchronized*/ FlowExpression fetch (final FlowExpressionId fei) { if (log.isDebugEnabled()) log.debug("fetch() for "+fei); if (fei == null) return null; FlowExpression result = (FlowExpression)this.cache.get(fei); if (result != null) return result; if (log.isDebugEnabled()) log.debug("fetch() not cached : "+fei); //log.debug // ("fetch()\n"+ // openwfe.org.xml.XmlUtils.toString(this.cache.getStatus())); //log.debug // ("fetch() cache size : "+this.cache.size()); result = super.fetch(fei); if (result != null) this.cache.put(result.getId(), result); return result; }
/** * Stores the flow expression (as it may have changed). */ public void update (final FlowExpression fe) throws PoolException { getCache().put(fe.getId(), fe); this.ts.store(fe); }
/** * Prepares a cache (with a given max number of cached elements). */ public XmlDocumentCache (final int maxSize) { super(); // is caching turned off ? if ( ! Utils.toBoolean (System.getProperty(SP_XML_DOCUMENT_CACHE), true)) { log.info("() XML caching is disabled."); return; } this.cache = new Cache(maxSize); }
/** * Removes a flow expression : * - removes it from cache; * - removes it from store (disk or db) * * This method is called by the replyToFather method, as the * expression tree gets diminished. */ public void removeExpression (final FlowExpression fe) { getCache().remove(fe.getId()); this.ts.remove(fe); }
/** * Retrieves an expression from the pool. * If the expression cannot be retrieved from the pool, null will be * returned. */ public FlowExpression fetch (final FlowExpressionId fei) { if (fei == null) return null; FlowExpression result = (FlowExpression)getCache().get(fei); if (result != null) return result; result = (FlowExpression)this.ts.get(fei); if (result != null) getCache().put(result.getId(), result); return result; }
this.cache.put(wi.getLastExpressionId(), wi);