You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2009/09/02 17:21:22 UTC
svn commit: r810556 [1/2] - in
/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae:
./ client/
Author: cwiklik
Date: Wed Sep 2 15:21:18 2009
New Revision: 810556
URL: http://svn.apache.org/viewvc?rev=810556&view=rev
Log:
UIMA-1541 Reformatted to conform to UIMA formatting guidelines. No other changes included.
Modified:
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/AsynchAECasManager.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/AsynchAECasManager_impl.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/Channel.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/EECasManager_impl.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCacheMBean.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InputChannel.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/OutputChannel.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/ParallelStep.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UIDGenerator.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UIMAEE_Constants.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsContext.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsThreadFactory.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsVersion.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaClassFactory.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaEEAdminContext.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaSerializer.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UniqueIdGenerator.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/client/UimaASProcessStatus.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/client/UimaASProcessStatusImpl.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/client/UimaASStatusCallbackListener.java
incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/client/UimaAsynchronousEngine.java
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/AsynchAECasManager.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/AsynchAECasManager.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/AsynchAECasManager.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/AsynchAECasManager.java Wed Sep 2 15:21:18 2009
@@ -28,24 +28,38 @@
import org.apache.uima.resource.ResourceManager;
import org.apache.uima.resource.metadata.ProcessingResourceMetaData;
-public interface AsynchAECasManager
-{
- public void addMetadata(ProcessingResourceMetaData meta);
- public ProcessingResourceMetaData getMetadata() throws ResourceInitializationException;
- public Map getMetadataAsMap() throws ResourceInitializationException;
- public void setMetadata(ProcessingResourceMetaData meta);
- public void initialize( int aCasPoolSize, String aContext) throws Exception;
- public void initialize( String aContext) throws Exception;
- public void initialize(int aCasPoolSize, String aContextName, Properties aPerformanceTuningSettings) throws Exception;
- public CAS getNewCas();
- public CAS getNewCas(String aContext);
- public CasManager getInternalCasManager();
- public boolean isInitialized();
- public void setInitialized(boolean initialized);
- public String getCasManagerContext();
- public ResourceManager getResourceManager();
- public void setInitialFsHeapSize( long aSizeInBytes);
- public long getInitialFsHeapSize();
-
-
+public interface AsynchAECasManager {
+ public void addMetadata(ProcessingResourceMetaData meta);
+
+ public ProcessingResourceMetaData getMetadata() throws ResourceInitializationException;
+
+ public Map getMetadataAsMap() throws ResourceInitializationException;
+
+ public void setMetadata(ProcessingResourceMetaData meta);
+
+ public void initialize(int aCasPoolSize, String aContext) throws Exception;
+
+ public void initialize(String aContext) throws Exception;
+
+ public void initialize(int aCasPoolSize, String aContextName,
+ Properties aPerformanceTuningSettings) throws Exception;
+
+ public CAS getNewCas();
+
+ public CAS getNewCas(String aContext);
+
+ public CasManager getInternalCasManager();
+
+ public boolean isInitialized();
+
+ public void setInitialized(boolean initialized);
+
+ public String getCasManagerContext();
+
+ public ResourceManager getResourceManager();
+
+ public void setInitialFsHeapSize(long aSizeInBytes);
+
+ public long getInitialFsHeapSize();
+
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/AsynchAECasManager_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/AsynchAECasManager_impl.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/AsynchAECasManager_impl.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/AsynchAECasManager_impl.java Wed Sep 2 15:21:18 2009
@@ -80,24 +80,24 @@
public void initialize(int aCasPoolSize, String aContextName) throws Exception {
Properties performanceTuningSettings = new Properties();
if (initialHeapSize > 0) {
- performanceTuningSettings.setProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE,
- Integer.valueOf((int) initialHeapSize).toString());
+ performanceTuningSettings.setProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE, Integer.valueOf(
+ (int) initialHeapSize).toString());
}
initialize(aCasPoolSize, aContextName, performanceTuningSettings);
}
public void initialize(int aCasPoolSize, String aContextName,
Properties aPerformanceTuningSettings) throws Exception {
-
+
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.CONFIG)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.CONFIG, CLASS_NAME.getName(),
- "initialize", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
- "UIMAEE_primary_cas_pool_init__CONFIG", new Object[] { aCasPoolSize, aContextName });
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.CONFIG, CLASS_NAME.getName(), "initialize",
+ UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_primary_cas_pool_init__CONFIG",
+ new Object[] { aCasPoolSize, aContextName });
}
// Create CAS Pool for incoming messages
casManager.defineCasPool(aContextName, aCasPoolSize, aPerformanceTuningSettings);
contextName = aContextName;
-
+
setInitialized(true);
if (aPerformanceTuningSettings != null) {
System.out.println("CasManager Initialized Cas Pool:" + aContextName + ". Cas Pool Size:"
@@ -140,8 +140,8 @@
}
/**
- * Constructs and returns a <code>ProcessingResourceMetaData</code> object that contains the
- * type system, indexes, and type priorities definitions for the CAS.
+ * Constructs and returns a <code>ProcessingResourceMetaData</code> object that contains the type
+ * system, indexes, and type priorities definitions for the CAS.
*
* @return processing resource metadata object containing the relevant parts of the CAS definition
*/
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/Channel.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/Channel.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/Channel.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/Channel.java Wed Sep 2 15:21:18 2009
@@ -19,14 +19,15 @@
package org.apache.uima.aae;
-public interface Channel
-{
+public interface Channel {
public static final int CloseAllChannels = 0;
+
public static final int InputChannels = 1;
public void stop() throws Exception;
+
public void stop(int channelsToStop) throws Exception;
- public String getName();
-
+ public String getName();
+
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/EECasManager_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/EECasManager_impl.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/EECasManager_impl.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/EECasManager_impl.java Wed Sep 2 15:21:18 2009
@@ -29,72 +29,64 @@
import org.apache.uima.resource.ResourceManager;
import org.apache.uima.resource.impl.CasManager_impl;
-public class EECasManager_impl extends CasManager_impl
-{
- Map casPoolMap = new HashMap();
- protected long initialCasHeapSize = 0;
-
- public EECasManager_impl(ResourceManager aResourceManager)
- {
- super(aResourceManager);
- }
- public void setInitialCasHeapSize( long anInitialCasHeapSize )
- {
- // Heap size is defined in terms of bytes. Uima core expects number of cells.
- // Each cell is 4 bytes. Divide heapSize expressed in bytes by 4.
- initialCasHeapSize = anInitialCasHeapSize/4;
- }
- public void defineCasPool(String aRequestorContextName, int aMinimumSize,
- Properties aPerformanceTuningSettings)
- throws ResourceInitializationException
- {
- if ( aPerformanceTuningSettings == null )
- {
- aPerformanceTuningSettings = new Properties();
- }
- if ( initialCasHeapSize > 0 )
- {
- aPerformanceTuningSettings.setProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE,
- Integer.valueOf((int)initialCasHeapSize).toString() );
- }
- super.defineCasPool(aRequestorContextName, aMinimumSize, aPerformanceTuningSettings);
- }
- @Override
- public void defineCasPool(UimaContextAdmin aRequestorContext,
- int aMinimumSize, Properties aPerformanceTuningSettings)
- throws ResourceInitializationException {
- if ( aPerformanceTuningSettings == null )
- {
- aPerformanceTuningSettings = new Properties();
- }
- if ( initialCasHeapSize > 0 )
- {
- aPerformanceTuningSettings.setProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE,
- Integer.valueOf((int)initialCasHeapSize).toString() );
- }
- super.defineCasPool(aRequestorContext, aMinimumSize, aPerformanceTuningSettings);
- }
-
- public void setPoolSize(String aRequestorContextName, int aSize )
- {
- casPoolMap.put(aRequestorContextName, aSize);
-
- }
- public int getCasPoolSize(String aRequestorContextName, int aMinimumSize)
- {
- int theSize = aMinimumSize;
- if ( casPoolMap.containsKey(aRequestorContextName) )
- {
- theSize += ((Integer)casPoolMap.get(aRequestorContextName)).intValue() - 1;
+public class EECasManager_impl extends CasManager_impl {
+ Map casPoolMap = new HashMap();
+
+ protected long initialCasHeapSize = 0;
+
+ public EECasManager_impl(ResourceManager aResourceManager) {
+ super(aResourceManager);
+ }
+
+ public void setInitialCasHeapSize(long anInitialCasHeapSize) {
+ // Heap size is defined in terms of bytes. Uima core expects number of cells.
+ // Each cell is 4 bytes. Divide heapSize expressed in bytes by 4.
+ initialCasHeapSize = anInitialCasHeapSize / 4;
+ }
+
+ public void defineCasPool(String aRequestorContextName, int aMinimumSize,
+ Properties aPerformanceTuningSettings) throws ResourceInitializationException {
+ if (aPerformanceTuningSettings == null) {
+ aPerformanceTuningSettings = new Properties();
+ }
+ if (initialCasHeapSize > 0) {
+ aPerformanceTuningSettings.setProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE, Integer.valueOf(
+ (int) initialCasHeapSize).toString());
+ }
+ super.defineCasPool(aRequestorContextName, aMinimumSize, aPerformanceTuningSettings);
+ }
+
+ @Override
+ public void defineCasPool(UimaContextAdmin aRequestorContext, int aMinimumSize,
+ Properties aPerformanceTuningSettings) throws ResourceInitializationException {
+ if (aPerformanceTuningSettings == null) {
+ aPerformanceTuningSettings = new Properties();
+ }
+ if (initialCasHeapSize > 0) {
+ aPerformanceTuningSettings.setProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE, Integer.valueOf(
+ (int) initialCasHeapSize).toString());
+ }
+ super.defineCasPool(aRequestorContext, aMinimumSize, aPerformanceTuningSettings);
+ }
+
+ public void setPoolSize(String aRequestorContextName, int aSize) {
+ casPoolMap.put(aRequestorContextName, aSize);
+
+ }
+
+ public int getCasPoolSize(String aRequestorContextName, int aMinimumSize) {
+ int theSize = aMinimumSize;
+ if (casPoolMap.containsKey(aRequestorContextName)) {
+ theSize += ((Integer) casPoolMap.get(aRequestorContextName)).intValue() - 1;
}
return theSize;
- }
-protected void finalize() throws Throwable
-{
- super.finalize();
- getCasToCasPoolMap().clear();
- casPoolMap.clear();
-}
+ }
+
+ protected void finalize() throws Throwable {
+ super.finalize();
+ getCasToCasPoolMap().clear();
+ casPoolMap.clear();
+ }
public void cleanUp() {
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java Wed Sep 2 15:21:18 2009
@@ -44,887 +44,799 @@
import org.apache.uima.flow.Step;
import org.apache.uima.util.Level;
-public class InProcessCache implements InProcessCacheMBean
-{
- /**
+public class InProcessCache implements InProcessCacheMBean {
+ /**
*
*/
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- private static final Class CLASS_NAME = InProcessCache.class;
+ private static final Class CLASS_NAME = InProcessCache.class;
- public static final int NotifyWhenRegistering = 1;
- private transient UIDGenerator idGenerator = new UIDGenerator();
- private ConcurrentHashMap cache = new ConcurrentHashMap();
+ public static final int NotifyWhenRegistering = 1;
- private String name = "InProcessCache";
- private List callbackListeners = new ArrayList();
-
- int size = 0;
+ private transient UIDGenerator idGenerator = new UIDGenerator();
- public void registerCallbackWhenCacheEmpty(EventSubscriber aController ) {
+ private ConcurrentHashMap cache = new ConcurrentHashMap();
+
+ private String name = "InProcessCache";
+
+ private List callbackListeners = new ArrayList();
+
+ int size = 0;
+
+ public void registerCallbackWhenCacheEmpty(EventSubscriber aController) {
registerCallbackWhenCacheEmpty(aController, 0);
}
- public void registerCallbackWhenCacheEmpty(EventSubscriber aController, int notification )
- {
- if ( !callbackListeners.isEmpty() )
- {
- Iterator it = callbackListeners.iterator();
- while( it.hasNext() )
- {
- EventSubscriber es = (EventSubscriber)it.next();
- if ( es == aController )
- {
- return;
- }
- }
- } else if ( notification == NotifyWhenRegistering ) {
- if ( isEmpty()) {
- aController.onCacheEmpty();
- }
- }
- // If not registered already add the event subscriber to the list of
- // of objects to be called when the cache becomes empty
- if ( !callbackListeners.contains(aController)) {
- callbackListeners.add(aController);
- }
- }
- public void destroy()
- {
- callbackListeners.clear();
- Set set = cache.entrySet();
- for( Iterator it = set.iterator(); it.hasNext();)
- {
- Map.Entry entry = (Map.Entry)it.next();
- CacheEntry cacheEntry = (CacheEntry)entry.getValue();
- if ( cacheEntry != null && cacheEntry.getCas() != null )
- {
- try
- {
- cacheEntry.getCas().release();
- }
- catch( Exception e){}
- }
- }
-
- cache.clear();
- }
-
- /**
- * Checks if a given input CAS is in pending state. CAS is in pending state if it has been
- * fully processed, *but* its subordinate CASes are still in play. Input CAS is only
- * returned back to the client if all if its subordinate CASes are fully processed.
- *
- * @param anInputCASReferenceId
- * @return
- * @throws Exception
- */
- public boolean isInputCASPendingReply( String anInputCASReferenceId ) throws Exception
- {
- if ( anInputCASReferenceId == null )
- {
+
+ public void registerCallbackWhenCacheEmpty(EventSubscriber aController, int notification) {
+ if (!callbackListeners.isEmpty()) {
+ Iterator it = callbackListeners.iterator();
+ while (it.hasNext()) {
+ EventSubscriber es = (EventSubscriber) it.next();
+ if (es == aController) {
+ return;
+ }
+ }
+ } else if (notification == NotifyWhenRegistering) {
+ if (isEmpty()) {
+ aController.onCacheEmpty();
+ }
+ }
+ // If not registered already add the event subscriber to the list of
+ // of objects to be called when the cache becomes empty
+ if (!callbackListeners.contains(aController)) {
+ callbackListeners.add(aController);
+ }
+ }
+
+ public void destroy() {
+ callbackListeners.clear();
+ Set set = cache.entrySet();
+ for (Iterator it = set.iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ CacheEntry cacheEntry = (CacheEntry) entry.getValue();
+ if (cacheEntry != null && cacheEntry.getCas() != null) {
+ try {
+ cacheEntry.getCas().release();
+ } catch (Exception e) {
+ }
+ }
+ }
+
+ cache.clear();
+ }
+
+ /**
+ * Checks if a given input CAS is in pending state. CAS is in pending state if it has been fully
+ * processed, *but* its subordinate CASes are still in play. Input CAS is only returned back to
+ * the client if all if its subordinate CASes are fully processed.
+ *
+ * @param anInputCASReferenceId
+ * @return
+ * @throws Exception
+ */
+ public boolean isInputCASPendingReply(String anInputCASReferenceId) throws Exception {
+ if (anInputCASReferenceId == null) {
return false;
}
- CacheEntry inputCASEntry =
- getCacheEntryForCAS( anInputCASReferenceId );
+ CacheEntry inputCASEntry = getCacheEntryForCAS(anInputCASReferenceId);
return inputCASEntry.isPendingReply();
- }
-
- public boolean producedCASesStillInPlay( String anInputCASReferenceId, String aSubordinateCASReferenceId ) throws Exception
- {
+ }
+
+ public boolean producedCASesStillInPlay(String anInputCASReferenceId,
+ String aSubordinateCASReferenceId) throws Exception {
Iterator it = cache.keySet().iterator();
- while( it.hasNext())
- {
+ while (it.hasNext()) {
String key = (String) it.next();
CacheEntry entry = (CacheEntry) cache.get(key);
- if ( entry != null && aSubordinateCASReferenceId != null && aSubordinateCASReferenceId.equals(key))
- {
- continue; // dont count the current subordinate
+ if (entry != null && aSubordinateCASReferenceId != null
+ && aSubordinateCASReferenceId.equals(key)) {
+ continue; // dont count the current subordinate
}
- if ( entry != null && anInputCASReferenceId.equals( entry.getInputCasReferenceId()))
- {
+ if (entry != null && anInputCASReferenceId.equals(entry.getInputCasReferenceId())) {
return true;
}
}
- return false;
- }
- public void releaseCASesProducedFromInputCAS( String anInputCASReferenceId )
- {
- if ( anInputCASReferenceId == null )
- {
- return;
- }
- Iterator it = cache.keySet().iterator();
- while( it.hasNext())
- {
- String key = (String) it.next();
- CacheEntry entry = (CacheEntry) cache.get(key);
- if ( entry != null && (anInputCASReferenceId.equals( key ) || anInputCASReferenceId.equals( entry.getInputCasReferenceId())))
- {
- if ( entry.getCas() != null )
- {
- entry.getCas().release();
- }
- remove(key);
- }
- }
-
- }
- public void releaseAllCASes()
- {
- Iterator it = cache.keySet().iterator();
- while( it.hasNext())
- {
- String key = (String) it.next();
- CacheEntry entry = (CacheEntry) cache.get(key);
- if ( entry != null && entry.getCas() != null )
- {
- try {
- entry.getCas().release();
- } catch( Exception e) {}
- }
- cache.remove(key);
- }
-
- }
- public void setName( String aName )
- {
- name = aName;
- }
- public String getName()
- {
- return name;
- }
- public void cancelTimers()
- {
- }
- public boolean isEmpty()
- {
- return (cache.size() == 0);
- }
- public void reset()
- {
- size = 0;
- }
- public int getSize()
- {
- return cache.size();
- }
-
- public void setSize( int i)
- {
- size = i;
- }
- public synchronized void dumpContents(String aControllerName)
- {
- int count=0;
-/*
- if ( UIMAFramework.getLogger().isLoggable(Level.FINEST) )
- {
- Iterator it = cache.keySet().iterator();
- StringBuffer sb = new StringBuffer("\n");
-
- while( it.hasNext() )
- {
- String key = (String) it.next();
- CacheEntry entry = (CacheEntry)cache.get(key);
- count++;
- if ( entry.isSubordinate())
- {
- sb.append(key+ " Number Of Child CASes In Play:"+entry.getSubordinateCasInPlayCount()+" Parent CAS id:"+entry.getInputCasReferenceId());
- }
- else
- {
- sb.append(key+ " *** Input CAS. Number Of Child CASes In Play:"+entry.getSubordinateCasInPlayCount());
- }
-
-// if ( entry.isWaitingForRelease() )
- // {
- // sb.append(" <<< Reached Final State in Controller:"+aControllerName);
- // }
-
- sb.append("\n");
- }
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(),
- "dumpContents", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_show_cache_entry_key__FINEST",
- new Object[] { aControllerName, count, sb.toString() });
-
- sb.setLength(0);
- }
- else if ( UIMAFramework.getLogger().isLoggable(Level.FINE) )
- {
- Iterator it = cache.keySet().iterator();
- StringBuffer sb = new StringBuffer("\n");
- int inFinalState=0;
-
- while( it.hasNext() )
- {
- String key = (String) it.next();
- CacheEntry entry = (CacheEntry)cache.get(key);
- count++;
-
- //if ( entry.isWaitingForRelease() )
- //{
- //inFinalState++;
- //}
-
- }
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(),
- "dumpContents", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_show_abbrev_cache_stats___FINE",
- new Object[] { aControllerName, count, inFinalState });
-
-
- }
-*/
- }
-
- public synchronized void remove(String aCasReferenceId)
- {
- if (aCasReferenceId != null && cache.containsKey(aCasReferenceId))
- {
-
+ return false;
+ }
+
+ public void releaseCASesProducedFromInputCAS(String anInputCASReferenceId) {
+ if (anInputCASReferenceId == null) {
+ return;
+ }
+ Iterator it = cache.keySet().iterator();
+ while (it.hasNext()) {
+ String key = (String) it.next();
+ CacheEntry entry = (CacheEntry) cache.get(key);
+ if (entry != null
+ && (anInputCASReferenceId.equals(key) || anInputCASReferenceId.equals(entry
+ .getInputCasReferenceId()))) {
+ if (entry.getCas() != null) {
+ entry.getCas().release();
+ }
+ remove(key);
+ }
+ }
+
+ }
+
+ public void releaseAllCASes() {
+ Iterator it = cache.keySet().iterator();
+ while (it.hasNext()) {
+ String key = (String) it.next();
+ CacheEntry entry = (CacheEntry) cache.get(key);
+ if (entry != null && entry.getCas() != null) {
+ try {
+ entry.getCas().release();
+ } catch (Exception e) {
+ }
+ }
+ cache.remove(key);
+ }
+
+ }
+
+ public void setName(String aName) {
+ name = aName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void cancelTimers() {
+ }
+
+ public boolean isEmpty() {
+ return (cache.size() == 0);
+ }
+
+ public void reset() {
+ size = 0;
+ }
+
+ public int getSize() {
+ return cache.size();
+ }
+
+ public void setSize(int i) {
+ size = i;
+ }
+
+ public synchronized void dumpContents(String aControllerName) {
+ int count = 0;
+ /*
+ * if ( UIMAFramework.getLogger().isLoggable(Level.FINEST) ) { Iterator it =
+ * cache.keySet().iterator(); StringBuffer sb = new StringBuffer("\n");
+ *
+ * while( it.hasNext() ) { String key = (String) it.next(); CacheEntry entry =
+ * (CacheEntry)cache.get(key); count++; if ( entry.isSubordinate()) { sb.append(key+
+ * " Number Of Child CASes In Play:"
+ * +entry.getSubordinateCasInPlayCount()+" Parent CAS id:"+entry.getInputCasReferenceId()); }
+ * else { sb.append(key+
+ * " *** Input CAS. Number Of Child CASes In Play:"+entry.getSubordinateCasInPlayCount()); }
+ *
+ * // if ( entry.isWaitingForRelease() ) // { //
+ * sb.append(" <<< Reached Final State in Controller:"+aControllerName); // }
+ *
+ * sb.append("\n"); } UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST,
+ * CLASS_NAME.getName(), "dumpContents", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ * "UIMAEE_show_cache_entry_key__FINEST", new Object[] { aControllerName, count, sb.toString()
+ * });
+ *
+ * sb.setLength(0); } else if ( UIMAFramework.getLogger().isLoggable(Level.FINE) ) { Iterator it
+ * = cache.keySet().iterator(); StringBuffer sb = new StringBuffer("\n"); int inFinalState=0;
+ *
+ * while( it.hasNext() ) { String key = (String) it.next(); CacheEntry entry =
+ * (CacheEntry)cache.get(key); count++;
+ *
+ * //if ( entry.isWaitingForRelease() ) //{ //inFinalState++; //}
+ *
+ * } UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(), "dumpContents",
+ * UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_show_abbrev_cache_stats___FINE", new
+ * Object[] { aControllerName, count, inFinalState });
+ *
+ *
+ * }
+ */
+ }
+
+ public synchronized void remove(String aCasReferenceId) {
+ if (aCasReferenceId != null && cache.containsKey(aCasReferenceId)) {
+
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "remove", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_remove_cache_entry_for_cas__FINE", new Object[] { aCasReferenceId });
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "remove",
+ UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_remove_cache_entry_for_cas__FINE", new Object[] { aCasReferenceId });
}
- cache.remove(aCasReferenceId);
- this.notifyAll();
- }
- else if ( aCasReferenceId == null )
- {
+ cache.remove(aCasReferenceId);
+ this.notifyAll();
+ } else if (aCasReferenceId == null) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "remove", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_cas_is_null_remove_from_cache_failed__FINE");
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "remove",
+ UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_cas_is_null_remove_from_cache_failed__FINE");
}
- }
- else
- {
+ } else {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "remove", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_cas_is_invalid_remove_from_cache_failed__FINE", new Object[] { aCasReferenceId });
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "remove",
+ UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_cas_is_invalid_remove_from_cache_failed__FINE",
+ new Object[] { aCasReferenceId });
}
- }
- if ( cache.size() == 0 && callbackListeners.size() > 0 )
- {
- for( int i=0; i < callbackListeners.size(); i++ )
- {
- ((EventSubscriber)callbackListeners.get(i)).onCacheEmpty();
- }
- }
-
- }
- public void removeCas(String aCasReferenceId)
- {
- if (!cache.containsKey(aCasReferenceId))
- {
- return;
- }
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- casRefEntry.deleteCAS();
- }
-
- public synchronized CacheEntry[] getCacheEntriesForEndpoint(String anEndpointName )
- {
- CacheEntry[] entries;
- ArrayList list = new ArrayList();
- Iterator it = cache.keySet().iterator();
- while( it.hasNext() )
- {
- String key = (String)it.next();
- CacheEntry entry = (CacheEntry)cache.get(key);
- if ( entry != null && entry.getEndpoint(anEndpointName) != null )
- {
- list.add(entry);
- }
- }
- if (list.size() > 0 )
- {
- entries = new CacheEntry[list.size()];
- list.toArray(entries);
- return entries;
- }
- return null;
- }
- public void saveSerializedCAS(String aCasReferenceId, String anXCAS)
- {
- if (!cache.containsKey(aCasReferenceId))
- {
- return;
- }
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- casRefEntry.setSerializedCas(anXCAS);
- }
-
- public String getSerializedCAS(String aCasReferenceId)
- {
- if (cache.containsKey(aCasReferenceId))
- {
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- return casRefEntry.getSerializedCas();
- }
- return null;
- }
-
- public void setCasProducer( String aCasReferenceId, String aCasProducerKey)
- {
- if (cache.containsKey(aCasReferenceId))
- {
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- casRefEntry.setCasProducerKey(aCasProducerKey);
- }
-
- }
-
- public String getCasProducer( String aCasReferenceId)
- {
- if (cache.containsKey(aCasReferenceId))
- {
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- return casRefEntry.getCasProducerKey();
- }
- return null;
- }
-
- public synchronized CAS getCasByReference(String aCasReferenceId)
- {
- if (!cache.containsKey(aCasReferenceId))
- {
- return null;
- }
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- return casRefEntry.getCas();
- }
-
- public MessageContext getMessageAccessorByReference(String aCasReferenceId)
- {
- if (!cache.containsKey(aCasReferenceId))
- {
- return null;
- }
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- return casRefEntry.getMessageAccessor();
- }
-
- public OutOfTypeSystemData getOutOfTypeSystemData(String aCasReferenceId)
- {
- if (!cache.containsKey(aCasReferenceId))
- {
- return null;
- }
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- return casRefEntry.getOtsd();
- }
- private synchronized CacheEntry getEntry(String aCasReferenceId)
- {
- if ( !cache.containsKey(aCasReferenceId))
- {
- return null;
- }
- return (CacheEntry) cache.get(aCasReferenceId);
- }
- public void addEndpoint( Endpoint anEndpoint, String aCasReferenceId)
- {
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- if ( !casRefEntry.getEndpointMap().containsKey(anEndpoint.getEndpoint())) {
- casRefEntry.addEndpoint(anEndpoint);
- }
- }
-
- public Endpoint getEndpoint(String anEndpointName, String aCasReferenceId)
- {
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- if ( anEndpointName == null && casRefEntry != null)
- {
- return casRefEntry.getMessageOrigin();
- }
- if ( casRefEntry == null )
- {
- return null;
- }
- else
- {
- return casRefEntry.getEndpoint(anEndpointName);
- }
- }
- public void removeEndpoint( String anEndpointName, String aCasReferenceId)
- {
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- casRefEntry.deleteEndpoint( anEndpointName);
- }
-
- public long getStartTime(String aCasReferenceId)
- {
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- return casRefEntry.getStartTime();
- }
- public synchronized boolean entryExists(String aCasReferenceId)
- {
- try
- {
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- if ( casRefEntry == null )
- {
- return false;
- }
- }
- catch( Exception e)
- {
- // ignore
- }
- return true;
- }
-
- public CacheEntry register(CAS aCAS, MessageContext aMessageContext, OutOfTypeSystemData otsd)
- throws AsynchAEException
- {
- return register(aCAS, aMessageContext, otsd, idGenerator.nextId());
- }
-
- public CacheEntry register(CAS aCAS, MessageContext aMessageContext, XmiSerializationSharedData sharedData)
- throws AsynchAEException
- {
- return register(aCAS, aMessageContext, sharedData, idGenerator.nextId());
- }
- public CacheEntry register(CAS aCAS, MessageContext aMessageContext, OutOfTypeSystemData otsd, String aCasReferenceId)
- throws AsynchAEException
- {
- return registerCacheEntry(aCasReferenceId, new CacheEntry(aCAS, aCasReferenceId, aMessageContext, otsd));
- }
- public CacheEntry register(CAS aCAS, MessageContext aMessageContext, XmiSerializationSharedData sharedData, String aCasReferenceId)
- throws AsynchAEException
- {
- return registerCacheEntry(aCasReferenceId, new CacheEntry(aCAS, aCasReferenceId, aMessageContext, sharedData));
- }
- public CacheEntry register(CAS aCAS, MessageContext aMessageContext, XmiSerializationSharedData sharedData,
- String aCasReferenceId, Marker marker, boolean acceptsDeltaCas)
- throws AsynchAEException
- {
- return registerCacheEntry(aCasReferenceId, new CacheEntry(aCAS, aCasReferenceId, aMessageContext, sharedData, marker, acceptsDeltaCas));
- }
-
- private synchronized CacheEntry registerCacheEntry( String aCasReferenceId, CacheEntry entry )
- {
- cache.put(aCasReferenceId, entry);
- return entry;
- }
- public boolean hasNoSubordinates(String aCasReferenceId)
- {
- Iterator it = cache.keySet().iterator();
- while( it.hasNext() )
- {
- String key = (String) it.next();
- CacheEntry entry = (CacheEntry)cache.get(key);
- if ( entry != null && entry.getInputCasReferenceId() != null && entry.getInputCasReferenceId().equals(aCasReferenceId))
- {
+ }
+ if (cache.size() == 0 && callbackListeners.size() > 0) {
+ for (int i = 0; i < callbackListeners.size(); i++) {
+ ((EventSubscriber) callbackListeners.get(i)).onCacheEmpty();
+ }
+ }
+
+ }
+
+ public void removeCas(String aCasReferenceId) {
+ if (!cache.containsKey(aCasReferenceId)) {
+ return;
+ }
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ casRefEntry.deleteCAS();
+ }
+
+ public synchronized CacheEntry[] getCacheEntriesForEndpoint(String anEndpointName) {
+ CacheEntry[] entries;
+ ArrayList list = new ArrayList();
+ Iterator it = cache.keySet().iterator();
+ while (it.hasNext()) {
+ String key = (String) it.next();
+ CacheEntry entry = (CacheEntry) cache.get(key);
+ if (entry != null && entry.getEndpoint(anEndpointName) != null) {
+ list.add(entry);
+ }
+ }
+ if (list.size() > 0) {
+ entries = new CacheEntry[list.size()];
+ list.toArray(entries);
+ return entries;
+ }
+ return null;
+ }
+
+ public void saveSerializedCAS(String aCasReferenceId, String anXCAS) {
+ if (!cache.containsKey(aCasReferenceId)) {
+ return;
+ }
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ casRefEntry.setSerializedCas(anXCAS);
+ }
+
+ public String getSerializedCAS(String aCasReferenceId) {
+ if (cache.containsKey(aCasReferenceId)) {
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ return casRefEntry.getSerializedCas();
+ }
+ return null;
+ }
+
+ public void setCasProducer(String aCasReferenceId, String aCasProducerKey) {
+ if (cache.containsKey(aCasReferenceId)) {
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ casRefEntry.setCasProducerKey(aCasProducerKey);
+ }
+
+ }
+
+ public String getCasProducer(String aCasReferenceId) {
+ if (cache.containsKey(aCasReferenceId)) {
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ return casRefEntry.getCasProducerKey();
+ }
+ return null;
+ }
+
+ public synchronized CAS getCasByReference(String aCasReferenceId) {
+ if (!cache.containsKey(aCasReferenceId)) {
+ return null;
+ }
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ return casRefEntry.getCas();
+ }
+
+ public MessageContext getMessageAccessorByReference(String aCasReferenceId) {
+ if (!cache.containsKey(aCasReferenceId)) {
+ return null;
+ }
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ return casRefEntry.getMessageAccessor();
+ }
+
+ public OutOfTypeSystemData getOutOfTypeSystemData(String aCasReferenceId) {
+ if (!cache.containsKey(aCasReferenceId)) {
+ return null;
+ }
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ return casRefEntry.getOtsd();
+ }
+
+ private synchronized CacheEntry getEntry(String aCasReferenceId) {
+ if (!cache.containsKey(aCasReferenceId)) {
+ return null;
+ }
+ return (CacheEntry) cache.get(aCasReferenceId);
+ }
+
+ public void addEndpoint(Endpoint anEndpoint, String aCasReferenceId) {
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ if (!casRefEntry.getEndpointMap().containsKey(anEndpoint.getEndpoint())) {
+ casRefEntry.addEndpoint(anEndpoint);
+ }
+ }
+
+ public Endpoint getEndpoint(String anEndpointName, String aCasReferenceId) {
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ if (anEndpointName == null && casRefEntry != null) {
+ return casRefEntry.getMessageOrigin();
+ }
+ if (casRefEntry == null) {
+ return null;
+ } else {
+ return casRefEntry.getEndpoint(anEndpointName);
+ }
+ }
+
+ public void removeEndpoint(String anEndpointName, String aCasReferenceId) {
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ casRefEntry.deleteEndpoint(anEndpointName);
+ }
+
+ public long getStartTime(String aCasReferenceId) {
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ return casRefEntry.getStartTime();
+ }
+
+ public synchronized boolean entryExists(String aCasReferenceId) {
+ try {
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ if (casRefEntry == null) {
+ return false;
+ }
+ } catch (Exception e) {
+ // ignore
+ }
+ return true;
+ }
+
+ public CacheEntry register(CAS aCAS, MessageContext aMessageContext, OutOfTypeSystemData otsd)
+ throws AsynchAEException {
+ return register(aCAS, aMessageContext, otsd, idGenerator.nextId());
+ }
+
+ public CacheEntry register(CAS aCAS, MessageContext aMessageContext,
+ XmiSerializationSharedData sharedData) throws AsynchAEException {
+ return register(aCAS, aMessageContext, sharedData, idGenerator.nextId());
+ }
+
+ public CacheEntry register(CAS aCAS, MessageContext aMessageContext, OutOfTypeSystemData otsd,
+ String aCasReferenceId) throws AsynchAEException {
+ return registerCacheEntry(aCasReferenceId, new CacheEntry(aCAS, aCasReferenceId,
+ aMessageContext, otsd));
+ }
+
+ public CacheEntry register(CAS aCAS, MessageContext aMessageContext,
+ XmiSerializationSharedData sharedData, String aCasReferenceId) throws AsynchAEException {
+ return registerCacheEntry(aCasReferenceId, new CacheEntry(aCAS, aCasReferenceId,
+ aMessageContext, sharedData));
+ }
+
+ public CacheEntry register(CAS aCAS, MessageContext aMessageContext,
+ XmiSerializationSharedData sharedData, String aCasReferenceId, Marker marker,
+ boolean acceptsDeltaCas) throws AsynchAEException {
+ return registerCacheEntry(aCasReferenceId, new CacheEntry(aCAS, aCasReferenceId,
+ aMessageContext, sharedData, marker, acceptsDeltaCas));
+ }
+
+ private synchronized CacheEntry registerCacheEntry(String aCasReferenceId, CacheEntry entry) {
+ cache.put(aCasReferenceId, entry);
+ return entry;
+ }
+
+ public boolean hasNoSubordinates(String aCasReferenceId) {
+ Iterator it = cache.keySet().iterator();
+ while (it.hasNext()) {
+ String key = (String) it.next();
+ CacheEntry entry = (CacheEntry) cache.get(key);
+ if (entry != null && entry.getInputCasReferenceId() != null
+ && entry.getInputCasReferenceId().equals(aCasReferenceId)) {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(),
- "hasNoSubordinates", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_cache_entry_exists___FINE",
- new Object[] { entry.getCasReferenceId(), entry.getInputCasReferenceId() });
+ "hasNoSubordinates", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_cache_entry_exists___FINE",
+ new Object[] { entry.getCasReferenceId(), entry.getInputCasReferenceId() });
}
- return false;
- }
- }
- return true;
- }
-
- public Endpoint getTopAncestorEndpoint(CacheEntry anEntry) throws Exception
- {
- if ( anEntry == null )
- {
- return null;
- }
-
- if ( anEntry.getInputCasReferenceId() == null )
- {
- return anEntry.getMessageOrigin();
- }
- CacheEntry parentEntry = getCacheEntryForCAS(anEntry.getInputCasReferenceId());
- return getTopAncestorEndpoint(parentEntry);
- }
- public synchronized CacheEntry getCacheEntryForCAS( String aCasReferenceId )
- throws AsynchAEException
- {
- CacheEntry casRefEntry = getEntry(aCasReferenceId);
- if ( casRefEntry == null )
- {
- throw new AsynchAEException( "Cas Not Found In CasManager Cache. CasReferenceId::"+aCasReferenceId+" is Invalid");
- }
- return casRefEntry;
- }
-
- public static class CacheEntry
- {
- public static final int FINAL_STATE = 1;
-
- private CAS cas;
-
- // the following is set to true if the CAS has been created by CAS Multiplier
- // This flag is used to determine if the CAS should be output to client.
- private boolean newCas;
-
- private String casReferenceId;
-
- // This is set if the CAS was produced by a Cas Multiplier
- private String inputCasReferenceId;
-
- // This is Cas Reference Id of the CAS produced by Remote CM
- private String remoteCMCasReferenceId;
-
- private DelegateStats stats;
-
- private MessageContext messageAccessor;
-
- private OutOfTypeSystemData otsd = null;
-
- private String serializedCas;
-
- private String casProducerKey;
-
- private Map endpointMap = new HashMap();
-
- private final long timeIn = System.nanoTime();
-
- private Endpoint messageOrigin;
-
- private Stack originStack = new Stack();
-
- private int highWaterMark;
-
- private XmiSerializationSharedData deserSharedData;
-
- private String aggregateProducingTheCas;
-
- private long timeWaitingForCAS = 0;
-
- private long timeToDeserializeCAS = 0;
-
- private long timeToSerializeCAS = 0;
-
- private long timeToProcessCAS = 0;
-
- private long totalTimeToProcessCAS = 0;
-
- private String casMultiplierKey;
-
- private boolean sendRequestToFreeCas = true;
-
- private boolean aborted = false;
-
- private boolean pendingReply = false;
-
- private long sequence = 0;
-
- private Endpoint freeCasEndpoint;
-
- private Marker marker = null;
-
- private boolean acceptsDeltaCas = false;
-
- private boolean sentDeltaCas = false;
- // list containing delegates that must be called sequentially. This list
- // is added to the cache if there are collocated delegates in a parallel
- // step. Only remote delegates can be part of the parallel step. Any
- // collocated delegates are removed from the parallel step added to the
- // list. The delegates in this list will be called sequentially when
- // all delegates in parallel step respond.
- private List delayedSingleStepList = null;
-
- protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext aMessageAccessor, OutOfTypeSystemData aotsd)
- {
- this(aCas, aCasReferenceId, aMessageAccessor);
- messageAccessor = aMessageAccessor;
- }
- protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext aMessageAccessor, XmiSerializationSharedData sdata)
- {
- this(aCas, aCasReferenceId, aMessageAccessor);
- deserSharedData = sdata;
- }
- protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext aMessageAccessor,
- XmiSerializationSharedData sdata, Marker aMarker, boolean acceptsDeltaCas)
- {
- this(aCas, aCasReferenceId, aMessageAccessor);
- deserSharedData = sdata;
- this.marker = aMarker;
- this.acceptsDeltaCas = acceptsDeltaCas;
- }
-
- private CacheEntry(CAS aCas, String aCasReferenceId, MessageContext aMessageAccessor )
- {
- cas = aCas;
- messageAccessor = aMessageAccessor;
- if ( aMessageAccessor != null )
- {
- messageOrigin = aMessageAccessor.getEndpoint();
- }
- casReferenceId = aCasReferenceId;
- try
- {
- if ( aMessageAccessor != null && aMessageAccessor.propertyExists(AsynchAEMessage.CasSequence) )
- {
- sequence = aMessageAccessor.getMessageLongProperty(AsynchAEMessage.CasSequence);
- }
- }
- catch( Exception e)
- {
- e.printStackTrace();
- }
- }
- public String getCasReferenceId()
- {
- return casReferenceId;
- }
-
- public Map getEndpointMap()
- {
- return endpointMap;
- }
- public String getInputCasReferenceId()
- {
- return inputCasReferenceId;
- }
-
- public void setInputCasReferenceId(String anInputCasReferenceId)
- {
- inputCasReferenceId = anInputCasReferenceId;
- }
-
- public void setStat( DelegateStats aStat)
- {
- stats = aStat;
- }
- public DelegateStats getStat()
- {
- return stats;
- }
- public void incrementTimeWaitingForCAS( long aTimeWaitingForCAS)
- {
- timeWaitingForCAS += aTimeWaitingForCAS;
- }
- public void incrementTimeToDeserializeCAS(long aTimeToDeserializeCAS)
- {
- timeToDeserializeCAS += aTimeToDeserializeCAS;
- }
- public void incrementTimeToProcessCAS(long aTimeToProcessCAS)
- {
- timeToProcessCAS += aTimeToProcessCAS;
- }
-
- public void setCasMultiplierKey( String aKey )
- {
- casMultiplierKey = aKey;
- }
-
- public String getCasMultiplierKey()
- {
- return casMultiplierKey;
- }
- public void incrementTimeToSerializeCAS(long aTimeToSerializeCAS)
- {
- timeToSerializeCAS += aTimeToSerializeCAS;
- }
- public long getTimeWaitingForCAS()
- {
- return timeWaitingForCAS;
- }
- public long getTimeToDeserializeCAS()
- {
- return timeToDeserializeCAS;
- }
- public long getTimeToSerializeCAS()
- {
- return timeToSerializeCAS;
- }
- public Endpoint getMessageOrigin()
- {
- //Endpoint ep = (Endpoint)originStack.pop();
- return messageOrigin;
- }
- public void addOrigin( Endpoint anEndpoint)
- {
- originStack.push(anEndpoint);
- }
- protected long getStartTime()
- {
- return timeIn;
- }
- protected void addEndpoint( Endpoint anEndpoint )
- {
- endpointMap.put(anEndpoint.getEndpoint(), anEndpoint);
- }
-
- protected Endpoint getEndpoint(String anEndpointName )
- {
- return (Endpoint)endpointMap.get(anEndpointName);
- }
- protected void deleteEndpoint( String anEndpointName )
- {
- if ( endpointMap.containsKey(anEndpointName))
- {
- endpointMap.remove(anEndpointName);
- }
- }
- protected void deleteCAS()
- {
- cas = null;
- otsd = null;
- }
- public CAS getCas()
- {
- return cas;
- }
- protected void setCas(CAS aCAS, OutOfTypeSystemData aotsd)
- {
- cas = aCAS;
- otsd = aotsd;
- }
-
- protected void setCas(CAS aCAS)
- {
- cas = aCAS;
- }
- protected void setSerializedCas(String aSerializedCas)
- {
- serializedCas = aSerializedCas;
- }
-
- protected String getSerializedCas()
- {
- return serializedCas;
- }
-
- protected MessageContext getMessageAccessor()
- {
- return messageAccessor;
- }
-
- public OutOfTypeSystemData getOtsd()
- {
- return otsd;
- }
- public int getHighWaterMark()
- {
- return highWaterMark;
- }
- public void setHighWaterMark(int aHighWaterMark)
- {
- highWaterMark = aHighWaterMark;
- }
- public boolean isNewCas()
- {
- return newCas;
- }
- public void setNewCas(boolean newCas, String producedIn)
- {
- this.newCas = newCas;
- aggregateProducingTheCas = producedIn;
- }
- public XmiSerializationSharedData getDeserSharedData()
- {
- return deserSharedData;
- }
-
- public void setXmiSerializationData( XmiSerializationSharedData anXmiSerializationData)
- {
- deserSharedData = anXmiSerializationData;
- }
-
- public String getCasProducerAggregateName()
- {
- return aggregateProducingTheCas;
- }
-
- public void setCasProducerKey( String aCasProducerKey )
- {
- casProducerKey = aCasProducerKey;
- }
-
- public String getCasProducerKey()
- {
- return casProducerKey;
- }
- public String getRemoteCMCasReferenceId()
- {
- return remoteCMCasReferenceId;
- }
- public void setRemoteCMCasReferenceId(String remoteCMCasReferenceId)
- {
- this.remoteCMCasReferenceId = remoteCMCasReferenceId;
- }
- public boolean shouldSendRequestToFreeCas()
- {
- return sendRequestToFreeCas;
- }
- public void setSendRequestToFreeCas(boolean sendRequestToFreeCas)
- {
- this.sendRequestToFreeCas = sendRequestToFreeCas;
- }
- public boolean isAborted()
- {
- return aborted;
- }
- public void setAborted(boolean aborted)
- {
- this.aborted = aborted;
- }
- public long getTimeToProcessCAS() {
- return timeToProcessCAS;
- }
- public void setTimeToProcessCAS(long aTimeToProcessCAS) {
- timeToProcessCAS = aTimeToProcessCAS;
- totalTimeToProcessCAS += aTimeToProcessCAS;
- }
- public long getTotalTimeToProcessCAS()
- {
- return totalTimeToProcessCAS;
- }
-
- public boolean isPendingReply() {
- return pendingReply;
- }
- public void setPendingReply(boolean pendingReply) {
- this.pendingReply = pendingReply;
- }
- public long getCasSequence()
- {
- return sequence;
- }
- public void setCasSequence(long sequence)
- {
- this.sequence = sequence;
- }
-
- public void setFreeCasEndpoint( Endpoint aFreeCasEndpoint )
- {
- freeCasEndpoint = aFreeCasEndpoint;
- }
- public Endpoint getFreeCasEndpoint()
- {
- return freeCasEndpoint;
- }
-
- public boolean acceptsDeltaCas() {
- return this.acceptsDeltaCas;
- }
-
- public void setSentDeltaCas(boolean sendingDeltaCas) {
- this.sentDeltaCas = sendingDeltaCas;
- }
-
- public boolean sentDeltaCas() {
- return this.sentDeltaCas;
- }
-
- public Marker getMarker() {
- return this.marker;
- }
-
- public void setDelayedSingleStepList( List aList) {
- delayedSingleStepList = aList;
- }
-
- public List getDelayedSingleStepList() {
- return delayedSingleStepList;
- }
-
- }
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Endpoint getTopAncestorEndpoint(CacheEntry anEntry) throws Exception {
+ if (anEntry == null) {
+ return null;
+ }
+
+ if (anEntry.getInputCasReferenceId() == null) {
+ return anEntry.getMessageOrigin();
+ }
+ CacheEntry parentEntry = getCacheEntryForCAS(anEntry.getInputCasReferenceId());
+ return getTopAncestorEndpoint(parentEntry);
+ }
+
+ public synchronized CacheEntry getCacheEntryForCAS(String aCasReferenceId)
+ throws AsynchAEException {
+ CacheEntry casRefEntry = getEntry(aCasReferenceId);
+ if (casRefEntry == null) {
+ throw new AsynchAEException("Cas Not Found In CasManager Cache. CasReferenceId::"
+ + aCasReferenceId + " is Invalid");
+ }
+ return casRefEntry;
+ }
+
+ public static class CacheEntry {
+ public static final int FINAL_STATE = 1;
+
+ private CAS cas;
+
+ // the following is set to true if the CAS has been created by CAS Multiplier
+ // This flag is used to determine if the CAS should be output to client.
+ private boolean newCas;
+
+ private String casReferenceId;
+
+ // This is set if the CAS was produced by a Cas Multiplier
+ private String inputCasReferenceId;
+
+ // This is Cas Reference Id of the CAS produced by Remote CM
+ private String remoteCMCasReferenceId;
+
+ private DelegateStats stats;
+
+ private MessageContext messageAccessor;
+
+ private OutOfTypeSystemData otsd = null;
+
+ private String serializedCas;
+ private String casProducerKey;
+
+ private Map endpointMap = new HashMap();
+
+ private final long timeIn = System.nanoTime();
+
+ private Endpoint messageOrigin;
+
+ private Stack originStack = new Stack();
+
+ private int highWaterMark;
+
+ private XmiSerializationSharedData deserSharedData;
+
+ private String aggregateProducingTheCas;
+
+ private long timeWaitingForCAS = 0;
+
+ private long timeToDeserializeCAS = 0;
+
+ private long timeToSerializeCAS = 0;
+
+ private long timeToProcessCAS = 0;
+
+ private long totalTimeToProcessCAS = 0;
+
+ private String casMultiplierKey;
+
+ private boolean sendRequestToFreeCas = true;
+
+ private boolean aborted = false;
+
+ private boolean pendingReply = false;
+
+ private long sequence = 0;
+
+ private Endpoint freeCasEndpoint;
+
+ private Marker marker = null;
+
+ private boolean acceptsDeltaCas = false;
+
+ private boolean sentDeltaCas = false;
+
+ // list containing delegates that must be called sequentially. This list
+ // is added to the cache if there are collocated delegates in a parallel
+ // step. Only remote delegates can be part of the parallel step. Any
+ // collocated delegates are removed from the parallel step added to the
+ // list. The delegates in this list will be called sequentially when
+ // all delegates in parallel step respond.
+ private List delayedSingleStepList = null;
+
+ protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext aMessageAccessor,
+ OutOfTypeSystemData aotsd) {
+ this(aCas, aCasReferenceId, aMessageAccessor);
+ messageAccessor = aMessageAccessor;
+ }
+
+ protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext aMessageAccessor,
+ XmiSerializationSharedData sdata) {
+ this(aCas, aCasReferenceId, aMessageAccessor);
+ deserSharedData = sdata;
+ }
+
+ protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext aMessageAccessor,
+ XmiSerializationSharedData sdata, Marker aMarker, boolean acceptsDeltaCas) {
+ this(aCas, aCasReferenceId, aMessageAccessor);
+ deserSharedData = sdata;
+ this.marker = aMarker;
+ this.acceptsDeltaCas = acceptsDeltaCas;
+ }
+
+ private CacheEntry(CAS aCas, String aCasReferenceId, MessageContext aMessageAccessor) {
+ cas = aCas;
+ messageAccessor = aMessageAccessor;
+ if (aMessageAccessor != null) {
+ messageOrigin = aMessageAccessor.getEndpoint();
+ }
+ casReferenceId = aCasReferenceId;
+ try {
+ if (aMessageAccessor != null
+ && aMessageAccessor.propertyExists(AsynchAEMessage.CasSequence)) {
+ sequence = aMessageAccessor.getMessageLongProperty(AsynchAEMessage.CasSequence);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public String getCasReferenceId() {
+ return casReferenceId;
+ }
+
+ public Map getEndpointMap() {
+ return endpointMap;
+ }
+
+ public String getInputCasReferenceId() {
+ return inputCasReferenceId;
+ }
+
+ public void setInputCasReferenceId(String anInputCasReferenceId) {
+ inputCasReferenceId = anInputCasReferenceId;
+ }
+
+ public void setStat(DelegateStats aStat) {
+ stats = aStat;
+ }
+
+ public DelegateStats getStat() {
+ return stats;
+ }
+
+ public void incrementTimeWaitingForCAS(long aTimeWaitingForCAS) {
+ timeWaitingForCAS += aTimeWaitingForCAS;
+ }
+
+ public void incrementTimeToDeserializeCAS(long aTimeToDeserializeCAS) {
+ timeToDeserializeCAS += aTimeToDeserializeCAS;
+ }
+
+ public void incrementTimeToProcessCAS(long aTimeToProcessCAS) {
+ timeToProcessCAS += aTimeToProcessCAS;
+ }
+
+ public void setCasMultiplierKey(String aKey) {
+ casMultiplierKey = aKey;
+ }
+
+ public String getCasMultiplierKey() {
+ return casMultiplierKey;
+ }
+
+ public void incrementTimeToSerializeCAS(long aTimeToSerializeCAS) {
+ timeToSerializeCAS += aTimeToSerializeCAS;
+ }
+
+ public long getTimeWaitingForCAS() {
+ return timeWaitingForCAS;
+ }
+
+ public long getTimeToDeserializeCAS() {
+ return timeToDeserializeCAS;
+ }
+
+ public long getTimeToSerializeCAS() {
+ return timeToSerializeCAS;
+ }
+
+ public Endpoint getMessageOrigin() {
+ // Endpoint ep = (Endpoint)originStack.pop();
+ return messageOrigin;
+ }
+
+ public void addOrigin(Endpoint anEndpoint) {
+ originStack.push(anEndpoint);
+ }
+
+ protected long getStartTime() {
+ return timeIn;
+ }
+
+ protected void addEndpoint(Endpoint anEndpoint) {
+ endpointMap.put(anEndpoint.getEndpoint(), anEndpoint);
+ }
+
+ protected Endpoint getEndpoint(String anEndpointName) {
+ return (Endpoint) endpointMap.get(anEndpointName);
+ }
+
+ protected void deleteEndpoint(String anEndpointName) {
+ if (endpointMap.containsKey(anEndpointName)) {
+ endpointMap.remove(anEndpointName);
+ }
+ }
+
+ protected void deleteCAS() {
+ cas = null;
+ otsd = null;
+ }
+
+ public CAS getCas() {
+ return cas;
+ }
+
+ protected void setCas(CAS aCAS, OutOfTypeSystemData aotsd) {
+ cas = aCAS;
+ otsd = aotsd;
+ }
+
+ protected void setCas(CAS aCAS) {
+ cas = aCAS;
+ }
+
+ protected void setSerializedCas(String aSerializedCas) {
+ serializedCas = aSerializedCas;
+ }
+
+ protected String getSerializedCas() {
+ return serializedCas;
+ }
+
+ protected MessageContext getMessageAccessor() {
+ return messageAccessor;
+ }
+
+ public OutOfTypeSystemData getOtsd() {
+ return otsd;
+ }
+
+ public int getHighWaterMark() {
+ return highWaterMark;
+ }
+
+ public void setHighWaterMark(int aHighWaterMark) {
+ highWaterMark = aHighWaterMark;
+ }
+
+ public boolean isNewCas() {
+ return newCas;
+ }
+
+ public void setNewCas(boolean newCas, String producedIn) {
+ this.newCas = newCas;
+ aggregateProducingTheCas = producedIn;
+ }
+
+ public XmiSerializationSharedData getDeserSharedData() {
+ return deserSharedData;
+ }
+
+ public void setXmiSerializationData(XmiSerializationSharedData anXmiSerializationData) {
+ deserSharedData = anXmiSerializationData;
+ }
+
+ public String getCasProducerAggregateName() {
+ return aggregateProducingTheCas;
+ }
+
+ public void setCasProducerKey(String aCasProducerKey) {
+ casProducerKey = aCasProducerKey;
+ }
+
+ public String getCasProducerKey() {
+ return casProducerKey;
+ }
+
+ public String getRemoteCMCasReferenceId() {
+ return remoteCMCasReferenceId;
+ }
+
+ public void setRemoteCMCasReferenceId(String remoteCMCasReferenceId) {
+ this.remoteCMCasReferenceId = remoteCMCasReferenceId;
+ }
+
+ public boolean shouldSendRequestToFreeCas() {
+ return sendRequestToFreeCas;
+ }
+
+ public void setSendRequestToFreeCas(boolean sendRequestToFreeCas) {
+ this.sendRequestToFreeCas = sendRequestToFreeCas;
+ }
+
+ public boolean isAborted() {
+ return aborted;
+ }
+
+ public void setAborted(boolean aborted) {
+ this.aborted = aborted;
+ }
+
+ public long getTimeToProcessCAS() {
+ return timeToProcessCAS;
+ }
+
+ public void setTimeToProcessCAS(long aTimeToProcessCAS) {
+ timeToProcessCAS = aTimeToProcessCAS;
+ totalTimeToProcessCAS += aTimeToProcessCAS;
+ }
+
+ public long getTotalTimeToProcessCAS() {
+ return totalTimeToProcessCAS;
+ }
+
+ public boolean isPendingReply() {
+ return pendingReply;
+ }
+
+ public void setPendingReply(boolean pendingReply) {
+ this.pendingReply = pendingReply;
+ }
+
+ public long getCasSequence() {
+ return sequence;
+ }
+
+ public void setCasSequence(long sequence) {
+ this.sequence = sequence;
+ }
+
+ public void setFreeCasEndpoint(Endpoint aFreeCasEndpoint) {
+ freeCasEndpoint = aFreeCasEndpoint;
+ }
+
+ public Endpoint getFreeCasEndpoint() {
+ return freeCasEndpoint;
+ }
+
+ public boolean acceptsDeltaCas() {
+ return this.acceptsDeltaCas;
+ }
+
+ public void setSentDeltaCas(boolean sendingDeltaCas) {
+ this.sentDeltaCas = sendingDeltaCas;
+ }
+
+ public boolean sentDeltaCas() {
+ return this.sentDeltaCas;
+ }
+
+ public Marker getMarker() {
+ return this.marker;
+ }
+
+ public void setDelayedSingleStepList(List aList) {
+ delayedSingleStepList = aList;
+ }
+
+ public List getDelayedSingleStepList() {
+ return delayedSingleStepList;
+ }
+
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCacheMBean.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCacheMBean.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCacheMBean.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCacheMBean.java Wed Sep 2 15:21:18 2009
@@ -21,15 +21,14 @@
import java.io.Serializable;
-public interface InProcessCacheMBean extends Serializable
-{
- public String getName();
-
- public void setName( String aName );
-
- public void reset();
-
- public int getSize();
-
- public void setSize( int i);
+public interface InProcessCacheMBean extends Serializable {
+ public String getName();
+
+ public void setName(String aName);
+
+ public void reset();
+
+ public int getSize();
+
+ public void setSize(int i);
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InputChannel.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InputChannel.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InputChannel.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InputChannel.java Wed Sep 2 15:21:18 2009
@@ -22,19 +22,29 @@
import org.apache.uima.aae.jmx.ServiceInfo;
import org.apache.uima.aae.message.MessageContext;
-public interface InputChannel extends Channel
-{
- public int getSessionAckMode();
- public void ackMessage( MessageContext aMessageContext );
- public String getServerUri();
- public void setServerUri(String aServerUri);
- public String getInputQueueName();
- public ServiceInfo getServiceInfo();
- public boolean isStopped();
+public interface InputChannel extends Channel {
+ public int getSessionAckMode();
+
+ public void ackMessage(MessageContext aMessageContext);
+
+ public String getServerUri();
+
+ public void setServerUri(String aServerUri);
+
+ public String getInputQueueName();
+
+ public ServiceInfo getServiceInfo();
+
+ public boolean isStopped();
+
public int getConcurrentConsumerCount();
- public void destroyListener( String anEndpointName, String aDelegateKey );
- public void createListener( String aDelegateKey ) throws Exception;
+
+ public void destroyListener(String anEndpointName, String aDelegateKey);
+
+ public void createListener(String aDelegateKey) throws Exception;
+
public boolean isFailed(String aDelegateKey);
- public boolean isListenerForDestination( String anEndpointName);
+
+ public boolean isListenerForDestination(String anEndpointName);
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/OutputChannel.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/OutputChannel.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/OutputChannel.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/OutputChannel.java Wed Sep 2 15:21:18 2009
@@ -27,43 +27,46 @@
import org.apache.uima.cas.CAS;
import org.apache.uima.resource.metadata.ProcessingResourceMetaData;
-public interface OutputChannel extends Channel
-{
- public void setController( AnalysisEngineController aContainer );
-
- public void initialize() throws AsynchAEException;
+public interface OutputChannel extends Channel {
+ public void setController(AnalysisEngineController aContainer);
- public void sendRequest( String aCasReferenceId, Endpoint anEndpoint ) throws AsynchAEException;
+ public void initialize() throws AsynchAEException;
- public void sendRequest( String aCasReferenceId, Endpoint[] anEndpoint ) throws AsynchAEException;
+ public void sendRequest(String aCasReferenceId, Endpoint anEndpoint) throws AsynchAEException;
- public void sendRequest( int aCommand, Endpoint anEndpoint ) throws AsynchAEException;
+ public void sendRequest(String aCasReferenceId, Endpoint[] anEndpoint) throws AsynchAEException;
- public void sendRequest( int aCommand, String aCasReferenceId, Endpoint anEndpoint ) throws AsynchAEException;
+ public void sendRequest(int aCommand, Endpoint anEndpoint) throws AsynchAEException;
- public void sendReply( int aCommand, Endpoint anEndpoint ) throws AsynchAEException;
+ public void sendRequest(int aCommand, String aCasReferenceId, Endpoint anEndpoint)
+ throws AsynchAEException;
- public void sendReply( int aCommand, Endpoint anEndpoint, String aCasReferenceId ) throws AsynchAEException;
+ public void sendReply(int aCommand, Endpoint anEndpoint) throws AsynchAEException;
- public void sendReply( CAS aCas, String anInputCasReferenceId, String aNewCasReferenceId, Endpoint anEndpoint, long sequence ) throws AsynchAEException;
-
- public void sendReply( String aCasReferenceId, Endpoint anEndpoint ) throws AsynchAEException;
+ public void sendReply(int aCommand, Endpoint anEndpoint, String aCasReferenceId)
+ throws AsynchAEException;
- public void sendReply( CacheEntry entry, Endpoint anEndpoint ) throws AsynchAEException;
+ public void sendReply(CAS aCas, String anInputCasReferenceId, String aNewCasReferenceId,
+ Endpoint anEndpoint, long sequence) throws AsynchAEException;
- // public void sendReply( AnalysisEngineMetaData anAnalysisEngineMetadata, Endpoint anEndpoint, boolean serialize ) throws AsynchAEException;
- public void sendReply( ProcessingResourceMetaData aProcessingResourceMetadata, Endpoint anEndpoint, boolean serialize ) throws AsynchAEException;
+ public void sendReply(String aCasReferenceId, Endpoint anEndpoint) throws AsynchAEException;
- public void sendReply(Throwable t, String aCasReferenceId, String aParentCasReferenceId, Endpoint anEndpoint, int aCommand) throws AsynchAEException;
-
- public void bindWithClientEndpoint( Endpoint anEndpoint ) throws Exception;
+ public void sendReply(CacheEntry entry, Endpoint anEndpoint) throws AsynchAEException;
+
+ // public void sendReply( AnalysisEngineMetaData anAnalysisEngineMetadata, Endpoint anEndpoint,
+ // boolean serialize ) throws AsynchAEException;
+ public void sendReply(ProcessingResourceMetaData aProcessingResourceMetadata,
+ Endpoint anEndpoint, boolean serialize) throws AsynchAEException;
+
+ public void sendReply(Throwable t, String aCasReferenceId, String aParentCasReferenceId,
+ Endpoint anEndpoint, int aCommand) throws AsynchAEException;
+
+ public void bindWithClientEndpoint(Endpoint anEndpoint) throws Exception;
+
+ public void setServerURI(String aServerURI);
+
+ public void stop();
+
+ public void cancelTimers();
-
- public void setServerURI( String aServerURI );
-
- public void stop();
-
- public void cancelTimers();
-
-
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/ParallelStep.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/ParallelStep.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/ParallelStep.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/ParallelStep.java Wed Sep 2 15:21:18 2009
@@ -22,35 +22,32 @@
import org.apache.uima.flow.FlowControllerContext;
import org.apache.uima.flow.Step;
-public class ParallelStep extends Step
-{
- public ParallelStep(String[] aCasProcessorKeys) {
- mKeys = aCasProcessorKeys;
- }
-
- /**
- * Gets the key of the Analysis Engine to which the CAS should be routed.
- *
- * @return an AnalysisEngine key
- */
- public String[] getAnalysisEngineKeys() {
- return mKeys;
- }
-
- /**
- * Sets the key of the Analysis Engine to which the CAS should be routed. By using this method, a
- * user's Flow implementation can (but is not required to) reuse the same SimpleStep object
- * multiple times.
- *
- * @return an Analysis Engine key. This must be one of the keys in the FlowController's
- * {@link FlowControllerContext#getAnalysisEngineMetaDataMap()}.
- */
- public void setAnalysisEngineKeys(String[] aKeys) {
- mKeys = aKeys;
- }
-
- private String[] mKeys;
-
+public class ParallelStep extends Step {
+ public ParallelStep(String[] aCasProcessorKeys) {
+ mKeys = aCasProcessorKeys;
+ }
+
+ /**
+ * Gets the key of the Analysis Engine to which the CAS should be routed.
+ *
+ * @return an AnalysisEngine key
+ */
+ public String[] getAnalysisEngineKeys() {
+ return mKeys;
+ }
+
+ /**
+ * Sets the key of the Analysis Engine to which the CAS should be routed. By using this method, a
+ * user's Flow implementation can (but is not required to) reuse the same SimpleStep object
+ * multiple times.
+ *
+ * @return an Analysis Engine key. This must be one of the keys in the FlowController's
+ * {@link FlowControllerContext#getAnalysisEngineMetaDataMap()}.
+ */
+ public void setAnalysisEngineKeys(String[] aKeys) {
+ mKeys = aKeys;
+ }
+ private String[] mKeys;
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UIDGenerator.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UIDGenerator.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UIDGenerator.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UIDGenerator.java Wed Sep 2 15:21:18 2009
@@ -21,13 +21,9 @@
import java.rmi.server.UID;
-public class UIDGenerator implements UniqueIdGenerator
-{
- public String nextId()
- {
- return new UID().toString();
- }
-
-
+public class UIDGenerator implements UniqueIdGenerator {
+ public String nextId() {
+ return new UID().toString();
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UIMAEE_Constants.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UIMAEE_Constants.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UIMAEE_Constants.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UIMAEE_Constants.java Wed Sep 2 15:21:18 2009
@@ -19,11 +19,9 @@
package org.apache.uima.aae;
-public class UIMAEE_Constants
-{
- public static final String JMS_LOG_RESOURCE_BUNDLE = "uimaee_messages";
- public static final String Terminate = "terminate";
-
+public class UIMAEE_Constants {
+ public static final String JMS_LOG_RESOURCE_BUNDLE = "uimaee_messages";
+ public static final String Terminate = "terminate";
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsContext.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsContext.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsContext.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsContext.java Wed Sep 2 15:21:18 2009
@@ -3,21 +3,19 @@
import java.util.concurrent.ConcurrentHashMap;
public class UimaAsContext extends ConcurrentHashMap {
-
+
private final static String CONSUMER_COUNT_KEY = "CONCURRENT_CONSUMER_COUNT";
-
- public void setConcurrentConsumerCount(int aCount)
- {
- put( CONSUMER_COUNT_KEY, aCount);
+
+ public void setConcurrentConsumerCount(int aCount) {
+ put(CONSUMER_COUNT_KEY, aCount);
}
-
+
public int getConcurrentConsumerCount() {
Object value = get(CONSUMER_COUNT_KEY);
- if ( value != null ) {
+ if (value != null) {
return Integer.valueOf((Integer) value);
}
return 0;
}
-
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsThreadFactory.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsThreadFactory.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsThreadFactory.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsThreadFactory.java Wed Sep 2 15:21:18 2009
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.uima.aae;
import java.util.concurrent.ThreadFactory;
@@ -26,59 +25,64 @@
import org.springframework.core.task.TaskRejectedException;
/**
- * Custom ThreadFactory for use in the TaskExecutor. The TaskExecutor is plugged in
- * by Spring from spring xml file generated by dd2spring. The TaskExecutor is only defined for
- * PrimitiveControllers and its main purpose is to provide thread pooling and management. Each
- * new thread produced by this ThreadFactory is used to initialize a dedicated AE instance in the
- * PrimitiveController.
+ * Custom ThreadFactory for use in the TaskExecutor. The TaskExecutor is plugged in by Spring from
+ * spring xml file generated by dd2spring. The TaskExecutor is only defined for PrimitiveControllers
+ * and its main purpose is to provide thread pooling and management. Each new thread produced by
+ * this ThreadFactory is used to initialize a dedicated AE instance in the PrimitiveController.
+ *
*
- *
*/
public class UimaAsThreadFactory implements ThreadFactory {
- private PrimitiveAnalysisEngineController controller;
- private ThreadGroup theThreadGroup;
- /**
- *
- *
- * @param tGroup
- * @param aController
- */
- public UimaAsThreadFactory( ThreadGroup tGroup, PrimitiveAnalysisEngineController aController ) {
- controller = aController;
- theThreadGroup = tGroup;
- }
- public void stop() {
- }
- /**
- * Creates a new thread, initializes instance of AE via a call on a given PrimitiveController.
- * Once the thread finishes initializing AE instance in the controller, it calls run() on
- * a given Runnable. This Runnable is a Worker instance managed by the TaskExecutor. When
- * the thread calls run() on the Runnable it blocks until the Worker releases it.
- */
- public Thread newThread(final Runnable r) {
- Thread newThread = null;
- try {
- newThread = new Thread(theThreadGroup, new Runnable() {
- public void run() {
- Thread.currentThread().setName(controller.getComponentName()+" Process Thread-"+Thread.currentThread().getId());
- try {
- if ( controller != null && !controller.threadAssignedToAE() ) {
- // call the controller to initialize next instance of AE. Once initialized this
- // AE instance process() method will only be called from this thread
- controller.initializeAnalysisEngine();
- }
- // Call given Worker (Runnable) run() method and block. This call block until the
- // TaskExecutor is terminated.
- r.run();
- } catch( Exception e) {
- //e.printStackTrace();
- return;
+ private PrimitiveAnalysisEngineController controller;
+
+ private ThreadGroup theThreadGroup;
+
+ /**
+ *
+ *
+ * @param tGroup
+ * @param aController
+ */
+ public UimaAsThreadFactory(ThreadGroup tGroup, PrimitiveAnalysisEngineController aController) {
+ controller = aController;
+ theThreadGroup = tGroup;
+ }
+
+ public void stop() {
+ }
+
+ /**
+ * Creates a new thread, initializes instance of AE via a call on a given PrimitiveController.
+ * Once the thread finishes initializing AE instance in the controller, it calls run() on a given
+ * Runnable. This Runnable is a Worker instance managed by the TaskExecutor. When the thread calls
+ * run() on the Runnable it blocks until the Worker releases it.
+ */
+ public Thread newThread(final Runnable r) {
+ Thread newThread = null;
+ try {
+ newThread = new Thread(theThreadGroup, new Runnable() {
+ public void run() {
+ Thread.currentThread().setName(
+ controller.getComponentName() + " Process Thread-"
+ + Thread.currentThread().getId());
+ try {
+ if (controller != null && !controller.threadAssignedToAE()) {
+ // call the controller to initialize next instance of AE. Once initialized this
+ // AE instance process() method will only be called from this thread
+ controller.initializeAnalysisEngine();
}
+ // Call given Worker (Runnable) run() method and block. This call block until the
+ // TaskExecutor is terminated.
+ r.run();
+ } catch (Exception e) {
+ // e.printStackTrace();
+ return;
}
- });
- } catch ( Exception e) {
- e.printStackTrace();
- }
- return newThread;
+ }
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
}
+ return newThread;
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsVersion.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsVersion.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsVersion.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsVersion.java Wed Sep 2 15:21:18 2009
@@ -25,7 +25,6 @@
*/
public class UimaAsVersion {
-
/**
* Gets the major version number of the UIMA AS implementation.
*
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaClassFactory.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaClassFactory.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaClassFactory.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaClassFactory.java Wed Sep 2 15:21:18 2009
@@ -52,7 +52,8 @@
/**
* Creates a resource specifier from a given file
*
- * @param aFileResource - resource filename
+ * @param aFileResource
+ * - resource filename
* @return ResourceSpecifier - new instance
*
* @throws InvalidXMLException
@@ -68,7 +69,7 @@
/**
* Creates and returns a new default Resource Manager
- *
+ *
* @return ResourceManager - new instance of a default ResourceManager
*/
public static ResourceManager produceResourceManager() {
@@ -90,14 +91,19 @@
return input;
}
+
/**
* Produces and initializes new FlowController
*
- * @param aeSpecifier -
+ * @param aeSpecifier
+ * -
* @param aFlowControllerDescriptor
- * @param anAggregateMergedTypeSystem - Merged type system from all delegates
- * @param aParentContext - reference to parent context
- * @param aSofaMappings -
+ * @param anAggregateMergedTypeSystem
+ * - Merged type system from all delegates
+ * @param aParentContext
+ * - reference to parent context
+ * @param aSofaMappings
+ * -
* @param aJmxManagementInterface
* @return
* @throws InvalidXMLException
@@ -117,7 +123,7 @@
key = fcd.getKey();
}
- ResourceManager resourceManager = aParentContext.getRootContext().getResourceManager();
+ ResourceManager resourceManager = aParentContext.getRootContext().getResourceManager();
XMLInputSource input = resolveImportByName(aFlowControllerDescriptor, resourceManager);
FlowControllerDescription specifier = (FlowControllerDescription) UIMAFramework
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaEEAdminContext.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaEEAdminContext.java?rev=810556&r1=810555&r2=810556&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaEEAdminContext.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaEEAdminContext.java Wed Sep 2 15:21:18 2009
@@ -19,11 +19,11 @@
package org.apache.uima.aae;
-public interface UimaEEAdminContext
-{
- public void shutdown();
- public void stopListener(String anEndpoint );
- public int getConcurrentConsumerCount( String anEndpointName );
+public interface UimaEEAdminContext {
+ public void shutdown();
+
+ public void stopListener(String anEndpoint);
+
+ public int getConcurrentConsumerCount(String anEndpointName);
-
}