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:22:15 UTC
svn commit: r810557 [5/7] - in
/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae:
controller/ delegate/ deploymentDescriptor/
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineControllerMBean.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineControllerMBean.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineControllerMBean.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/BaseAnalysisEngineControllerMBean.java Wed Sep 2 15:22:13 2009
@@ -21,21 +21,33 @@
import java.io.Serializable;
-public interface BaseAnalysisEngineControllerMBean extends Serializable
-{
- public String getServiceName();
- public String getDeploymentMode();
- public String getBrokerURL();
- public String getInputQueue();
- public String getComponentName();
- public long getIdleTime();
- public long getTotalTimeSpentSerializingCAS();
- public long getTotalTimeSpendDeSerializingCAS();
- public long getTotalTimeSpentWaitingForFreeCASInstance();
- public long getTotalNumberOfCASesReceived();
- public long getTotalNumberOfCASesProcessed();
- public long getTotalNumberOfCASesDropped();
- public long getTotalNumberOfErrors();
- public String getDeploymentDescriptor();
+public interface BaseAnalysisEngineControllerMBean extends Serializable {
+ public String getServiceName();
+
+ public String getDeploymentMode();
+
+ public String getBrokerURL();
+
+ public String getInputQueue();
+
+ public String getComponentName();
+
+ public long getIdleTime();
+
+ public long getTotalTimeSpentSerializingCAS();
+
+ public long getTotalTimeSpendDeSerializingCAS();
+
+ public long getTotalTimeSpentWaitingForFreeCASInstance();
+
+ public long getTotalNumberOfCASesReceived();
+
+ public long getTotalNumberOfCASesProcessed();
+
+ public long getTotalNumberOfCASesDropped();
+
+ public long getTotalNumberOfErrors();
+
+ public String getDeploymentDescriptor();
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Controller.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Controller.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Controller.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Controller.java Wed Sep 2 15:22:13 2009
@@ -23,24 +23,27 @@
import org.apache.uima.aae.UIMAEE_Constants;
import org.apache.uima.util.Level;
-public class Controller implements ControllerMBean{
+public class Controller implements ControllerMBean {
private static final Class CLASS_NAME = ControllerMBean.class;
/**
*
*/
private static final long serialVersionUID = 1L;
+
private AnalysisEngineController controller;
- public Controller( AnalysisEngineController aController) {
+ public Controller(AnalysisEngineController aController) {
controller = aController;
}
+
public void completeProcessingAndStop() {
- System.out.println("************> Controller:"+controller.getComponentName()+" JMX MBean Received Stop Command");
+ System.out.println("************> Controller:" + controller.getComponentName()
+ + " JMX MBean Received Stop Command");
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
- "completeProcessingAndStop", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_jmx_stop_called__INFO",
- new Object[] { controller.getComponentName() });
+ "completeProcessingAndStop", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAEE_jmx_stop_called__INFO", new Object[] { controller.getComponentName() });
}
controller.quiesceAndStop();
@@ -48,11 +51,11 @@
public void stopNow() {
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
- "stopNow", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_jmx_stopNow_called__INFO",
- new Object[] { controller.getComponentName()});
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(), "stopNow",
+ UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_jmx_stopNow_called__INFO",
+ new Object[] { controller.getComponentName() });
}
controller.terminate();
}
-
+
}
\ No newline at end of file
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerCallbackListener.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerCallbackListener.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerCallbackListener.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerCallbackListener.java Wed Sep 2 15:22:13 2009
@@ -19,12 +19,15 @@
package org.apache.uima.aae.controller;
-public interface ControllerCallbackListener
-{
- public void notifyOnTermination( String aMessage );
- public void notifyOnInitializationFailure(AnalysisEngineController aController, Exception e);
- public void notifyOnInitializationSuccess(AnalysisEngineController aController);
- public void notifyOnInitializationFailure( Exception e);
- public void notifyOnInitializationSuccess();
+public interface ControllerCallbackListener {
+ public void notifyOnTermination(String aMessage);
+
+ public void notifyOnInitializationFailure(AnalysisEngineController aController, Exception e);
+
+ public void notifyOnInitializationSuccess(AnalysisEngineController aController);
+
+ public void notifyOnInitializationFailure(Exception e);
+
+ public void notifyOnInitializationSuccess();
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerLatch.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerLatch.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerLatch.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerLatch.java Wed Sep 2 15:22:13 2009
@@ -23,38 +23,35 @@
import org.apache.uima.aae.error.AsynchAEException;
-public class ControllerLatch
-{
- private final CountDownLatch latch = new CountDownLatch(1);
- private final AnalysisEngineController controller;
-
- public ControllerLatch( AnalysisEngineController aController) {
- controller = aController;
- }
- public void waitUntilInitialized() throws AsynchAEException
- {
- try
- {
- latch.await();
- }
- catch( InterruptedException e)
- {
- throw new AsynchAEException(e);
- }
- }
- public void release()
- {
- latch.countDown();
-
- }
- public void openLatch(String aName, boolean isTopLevelAggregate, boolean showMsg)
- {
- release();
- if ( !showMsg )
- {
- return;
- }
- System.out.println("Service:"+controller.getComponentName()+" Initialized. Ready To Process Messages From Queue:"+aName);
- }
+public class ControllerLatch {
+ private final CountDownLatch latch = new CountDownLatch(1);
+
+ private final AnalysisEngineController controller;
+
+ public ControllerLatch(AnalysisEngineController aController) {
+ controller = aController;
+ }
+
+ public void waitUntilInitialized() throws AsynchAEException {
+ try {
+ latch.await();
+ } catch (InterruptedException e) {
+ throw new AsynchAEException(e);
+ }
+ }
+
+ public void release() {
+ latch.countDown();
+
+ }
+
+ public void openLatch(String aName, boolean isTopLevelAggregate, boolean showMsg) {
+ release();
+ if (!showMsg) {
+ return;
+ }
+ System.out.println("Service:" + controller.getComponentName()
+ + " Initialized. Ready To Process Messages From Queue:" + aName);
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerLifecycle.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerLifecycle.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerLifecycle.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerLifecycle.java Wed Sep 2 15:22:13 2009
@@ -20,32 +20,29 @@
package org.apache.uima.aae.controller;
/**
- * Interface defining methods to enable stopping of Asynchronous Service.
+ * Interface defining methods to enable stopping of Asynchronous Service.
*/
-public interface ControllerLifecycle
-{
- /**
- * Called to initiate shutdown of the Asynchronous Service. An implementation
- * can close an input and output channels and do any necessary cleanup before
- * terminating.
- */
- public void terminate();
+public interface ControllerLifecycle {
+ /**
+ * Called to initiate shutdown of the Asynchronous Service. An implementation can close an input
+ * and output channels and do any necessary cleanup before terminating.
+ */
+ public void terminate();
-
- /**
- * Register one or more listeners through which the controller can send
- * notification of events.
- *
- *
- * @param aListener - application listener object to register
- */
- public void addControllerCallbackListener(ControllerCallbackListener aListener);
+ /**
+ * Register one or more listeners through which the controller can send notification of events.
+ *
+ *
+ * @param aListener
+ * - application listener object to register
+ */
+ public void addControllerCallbackListener(ControllerCallbackListener aListener);
-
- /**
- * Removes named application listener.
- *
- * @param aListener - application listener to remove
- */
- public void removeControllerCallbackListener(ControllerCallbackListener aListener);
+ /**
+ * Removes named application listener.
+ *
+ * @param aListener
+ * - application listener to remove
+ */
+ public void removeControllerCallbackListener(ControllerCallbackListener aListener);
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerMBean.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerMBean.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerMBean.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/ControllerMBean.java Wed Sep 2 15:22:13 2009
@@ -21,8 +21,8 @@
import java.io.Serializable;
-public interface ControllerMBean extends Serializable{
+public interface ControllerMBean extends Serializable {
public void completeProcessingAndStop();
-
+
public void stopNow();
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Endpoint.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Endpoint.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Endpoint.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Endpoint.java Wed Sep 2 15:22:13 2009
@@ -22,148 +22,156 @@
import org.apache.uima.aae.error.AsynchAEException;
import org.apache.uima.aae.jmx.ServiceInfo;
-public interface Endpoint
-{
+public interface Endpoint {
public static final int OK = 1;
+
public static final int FAILED = 2;
+
public static final int DISABLED = 3;
-
- public int getMetadataRequestTimeout();
- public void setController( AnalysisEngineController aController);
- public void startCheckpointTimer();
- public long getCheckpointTimer();
-
- public boolean isRetryEnabled();
- public void setMetadataRequestTimeout(int metadataRequestTimeout);
-
- public int getProcessRequestTimeout();
-
- public void setReplyEndpoint(boolean tORf );
-
- public boolean isReplyEndpoint();
-
- public void setProcessRequestTimeout(int processRequestTimeout);
-
- public boolean completedProcessingCollection();
-
- public void setCompletedProcessingCollection(boolean completed);
-
- public void setNoConsumers(boolean trueOrFalse);
-
- public boolean hasNoConsumers();
-
- public boolean isInitialized();
-
- public void setInitialized(boolean initialized);
-
- public String getEndpoint();
-
- public boolean isFinal();
- public void setFinal(boolean isFinal);
-
- public long getEntryTime();
-
- public void setEndpoint(String endpoint);
-
- public String getServerURI();
-
- public void setServerURI(String serverURI);
-
- public void startMetadataRequestTimer();
-
- public void startCollectionProcessCompleteTimer();
-
- public void startProcessRequestTimer(String aCasReferenceId);
-
- public void cancelTimer();
-
- public boolean isWaitingForResponse();
-
- public void setWaitingForResponse(boolean isWaiting);
-
- public void initialize() throws AsynchAEException;
-
- public void setDescriptor( String aDescriptor );
-
- public String getDescriptor();
-
- public void setRemote( boolean aRemote) ;
-
- public String getReplyToEndpoint();
-
- public boolean isRemote();
-
- public String getSerializer();
-
- public void close();
-
- public boolean isOpen();
-
- public void setHighWaterMark( String aHighWaterMark );
-
- public String getHighWaterMark();
-
- public boolean remove();
-
- public void setRemove(boolean removeIt);
-
- public boolean isCasMultiplier();
-
- public void setIsCasMultiplier(boolean trueORfalse);
-
- public void setShadowCasPoolSize( int aPoolSize );
-
- public int getShadowPoolSize();
-
- public ServiceInfo getServiceInfo();
-
- public Object getDestination();
-
- public void setDestination( Object aDestination);
-
- public void setCommand( int aCommand );
-
- public int getCommand();
-
- public void setRegisteredWithParent();
-
- public boolean isRegisteredWithParent();
-
- public void setInitialFsHeapSize(int aHeapSize);
-
- public void setTempReplyDestination(boolean isTempReplyDestination );
-
- public boolean isTempReplyDestination();
- public void setReplyDestinationFailed();
-
- public boolean replyDestinationFailed();
- public void setIdleTime( long anIdleTime );
-
- public long getIdleTime();
-
- public void setEndpointServer( String anEndpointServer );
-
- public String getEndpointServer();
-
+
+ public int getMetadataRequestTimeout();
+
+ public void setController(AnalysisEngineController aController);
+
+ public void startCheckpointTimer();
+
+ public long getCheckpointTimer();
+
+ public boolean isRetryEnabled();
+
+ public void setMetadataRequestTimeout(int metadataRequestTimeout);
+
+ public int getProcessRequestTimeout();
+
+ public void setReplyEndpoint(boolean tORf);
+
+ public boolean isReplyEndpoint();
+
+ public void setProcessRequestTimeout(int processRequestTimeout);
+
+ public boolean completedProcessingCollection();
+
+ public void setCompletedProcessingCollection(boolean completed);
+
+ public void setNoConsumers(boolean trueOrFalse);
+
+ public boolean hasNoConsumers();
+
+ public boolean isInitialized();
+
+ public void setInitialized(boolean initialized);
+
+ public String getEndpoint();
+
+ public boolean isFinal();
+
+ public void setFinal(boolean isFinal);
+
+ public long getEntryTime();
+
+ public void setEndpoint(String endpoint);
+
+ public String getServerURI();
+
+ public void setServerURI(String serverURI);
+
+ public void startMetadataRequestTimer();
+
+ public void startCollectionProcessCompleteTimer();
+
+ public void startProcessRequestTimer(String aCasReferenceId);
+
+ public void cancelTimer();
+
+ public boolean isWaitingForResponse();
+
+ public void setWaitingForResponse(boolean isWaiting);
+
+ public void initialize() throws AsynchAEException;
+
+ public void setDescriptor(String aDescriptor);
+
+ public String getDescriptor();
+
+ public void setRemote(boolean aRemote);
+
+ public String getReplyToEndpoint();
+
+ public boolean isRemote();
+
+ public String getSerializer();
+
+ public void close();
+
+ public boolean isOpen();
+
+ public void setHighWaterMark(String aHighWaterMark);
+
+ public String getHighWaterMark();
+
+ public boolean remove();
+
+ public void setRemove(boolean removeIt);
+
+ public boolean isCasMultiplier();
+
+ public void setIsCasMultiplier(boolean trueORfalse);
+
+ public void setShadowCasPoolSize(int aPoolSize);
+
+ public int getShadowPoolSize();
+
+ public ServiceInfo getServiceInfo();
+
+ public Object getDestination();
+
+ public void setDestination(Object aDestination);
+
+ public void setCommand(int aCommand);
+
+ public int getCommand();
+
+ public void setRegisteredWithParent();
+
+ public boolean isRegisteredWithParent();
+
+ public void setInitialFsHeapSize(int aHeapSize);
+
+ public void setTempReplyDestination(boolean isTempReplyDestination);
+
+ public boolean isTempReplyDestination();
+
+ public void setReplyDestinationFailed();
+
+ public boolean replyDestinationFailed();
+
+ public void setIdleTime(long anIdleTime);
+
+ public long getIdleTime();
+
+ public void setEndpointServer(String anEndpointServer);
+
+ public String getEndpointServer();
+
public void setConcurrentRequestConsumers(int aConsumerCount);
-
+
public int getConcurrentRequestConsumers();
public void setConcurrentReplyConsumers(int aConsumerCount);
-
+
public int getConcurrentReplyConsumers();
-
- public void setSerializer( String aSerializer );
-
- public void setStatus( int aStatus);
-
+
+ public void setSerializer(String aSerializer);
+
+ public void setStatus(int aStatus);
+
public int getStatus();
-
- public void setDelegateKey( String aDelegateKey );
-
+
+ public void setDelegateKey(String aDelegateKey);
+
public String getDelegateKey();
public void setProcessParentLast(boolean parentLast);
-
+
public boolean processParentLast();
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Endpoint_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Endpoint_impl.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Endpoint_impl.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/Endpoint_impl.java Wed Sep 2 15:22:13 2009
@@ -33,599 +33,498 @@
import org.apache.uima.analysis_engine.AnalysisEngine;
import org.apache.uima.util.Level;
-public class Endpoint_impl implements Endpoint, Cloneable
-{
- private static final Class CLASS_NAME = Endpoint_impl.class;
-
- private volatile Object destination = null;
-
- private String endpoint;
-
- private String serverURI;
-
- private volatile boolean initialized;
-
- private Timer timer;
-
- private String replyTo;
-
- private volatile boolean waitingForResponse;
-
- private int metadataRequestTimeout;
-
- private int processRequestTimeout;
-
- private int collectionProcessCompleteTimeout;
-
- private volatile boolean isRemote;
-
- private String descriptor;
-
- private String serializer="xmi";
-
- private volatile boolean finalEndpoint;
-
- private final long timeIn = System.nanoTime();
-
- private long checkpointTimer;
-
- private AnalysisEngineController controller;
-
- private Endpoint selfRef = this;
-
- private volatile boolean retryEnabled;
-
- private Object monitor = new Object();
-
- private String highWaterMark = null;
-
- private volatile boolean completedProcessingCollection;
-
- private volatile boolean noConsumers =false;
-
- private volatile boolean remove = false;
-
- private volatile boolean isCasMultiplier = false;
-
- private int shadowCasPoolSize = 0;
-
- private volatile boolean isReplyEndpointFlag;
-
- private ServiceInfo serviceInfo = null;
-
- private int command;
-
- private volatile boolean registeredWithParent;
-
- private volatile boolean tempReplyDestination;
-
- private int initialHeapSize;
-
- private volatile boolean replyDestinationFailed;
-
- private long idleTime=0;
-
- private int concurrentRequestConsumers = 1;
-
- private int concurrentReplyConsumers = 1;
-
- // This is supplied by the remote client. It needs to be
- // echoed back to the client.
- private String endpointServer = null;
-
- private int status;
-
- private String delegateKey;
- private volatile boolean processParentLast=false;
-
- public Endpoint_impl() {
- status = Endpoint.OK;
- }
-
- public void setProcessParentLast (boolean parentLast) {
- processParentLast = parentLast;
- }
-
- public boolean processParentLast () {
- return processParentLast ;
- }
-
-
- public int getCommand()
- {
- return command;
- }
-
- public void setCommand(int command)
- {
- this.command = command;
- }
-
- public void setNoConsumers(boolean trueOrFalse)
- {
- noConsumers = trueOrFalse;
- }
-
- public void setReplyEndpoint(boolean tORf )
- {
- isReplyEndpointFlag = tORf;
- }
- public boolean isReplyEndpoint()
- {
- return isReplyEndpointFlag;
- }
- public boolean remove()
- {
- return remove;
-
- }
-
- public void setRemove( boolean rm)
- {
- remove = rm;
- }
- public boolean hasNoConsumers()
- {
- return noConsumers;
- }
- public String getReplyToEndpoint()
- {
- return replyTo;
- }
- public void setReplyToEndpoint( String anEndpointName )
- {
- replyTo = anEndpointName;
- }
- public boolean completedProcessingCollection()
- {
- return completedProcessingCollection;
- }
-
- public void setCompletedProcessingCollection( boolean completed )
- {
- completedProcessingCollection = completed;
- }
-
-
- public void setHighWaterMark( String aHighWaterMark )
- {
- highWaterMark = aHighWaterMark;
- }
-
- public String getHighWaterMark()
- {
- return highWaterMark;
- }
-
- public boolean isRetryEnabled()
- {
- return retryEnabled;
- }
- public void setRetryEnabled(boolean retryEnabled)
- {
- this.retryEnabled = retryEnabled;
- }
- public void setController( AnalysisEngineController aController )
- {
- controller = aController;
- }
- public void startCheckpointTimer()
- {
- checkpointTimer = System.nanoTime();
- }
- public long getCheckpointTimer()
- {
- return checkpointTimer;
- }
-
-
- public long getEntryTime()
- {
- return timeIn;
- }
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch ( CloneNotSupportedException e)
- {
- throw new InternalError(e.toString());
- }
- }
-
- public String getSerializer()
- {
- return serializer;
- }
- public boolean isFinal()
- {
- return finalEndpoint;
- }
-
- public void setFinal( boolean isFinal )
- {
- finalEndpoint = isFinal;
- }
- public void setSerializer(String serializer)
- {
- if ( serializer != null && serializer.trim().length() > 0 ) {
+public class Endpoint_impl implements Endpoint, Cloneable {
+ private static final Class CLASS_NAME = Endpoint_impl.class;
+
+ private volatile Object destination = null;
+
+ private String endpoint;
+
+ private String serverURI;
+
+ private volatile boolean initialized;
+
+ private Timer timer;
+
+ private String replyTo;
+
+ private volatile boolean waitingForResponse;
+
+ private int metadataRequestTimeout;
+
+ private int processRequestTimeout;
+
+ private int collectionProcessCompleteTimeout;
+
+ private volatile boolean isRemote;
+
+ private String descriptor;
+
+ private String serializer = "xmi";
+
+ private volatile boolean finalEndpoint;
+
+ private final long timeIn = System.nanoTime();
+
+ private long checkpointTimer;
+
+ private AnalysisEngineController controller;
+
+ private Endpoint selfRef = this;
+
+ private volatile boolean retryEnabled;
+
+ private Object monitor = new Object();
+
+ private String highWaterMark = null;
+
+ private volatile boolean completedProcessingCollection;
+
+ private volatile boolean noConsumers = false;
+
+ private volatile boolean remove = false;
+
+ private volatile boolean isCasMultiplier = false;
+
+ private int shadowCasPoolSize = 0;
+
+ private volatile boolean isReplyEndpointFlag;
+
+ private ServiceInfo serviceInfo = null;
+
+ private int command;
+
+ private volatile boolean registeredWithParent;
+
+ private volatile boolean tempReplyDestination;
+
+ private int initialHeapSize;
+
+ private volatile boolean replyDestinationFailed;
+
+ private long idleTime = 0;
+
+ private int concurrentRequestConsumers = 1;
+
+ private int concurrentReplyConsumers = 1;
+
+ // This is supplied by the remote client. It needs to be
+ // echoed back to the client.
+ private String endpointServer = null;
+
+ private int status;
+
+ private String delegateKey;
+
+ private volatile boolean processParentLast = false;
+
+ public Endpoint_impl() {
+ status = Endpoint.OK;
+ }
+
+ public void setProcessParentLast(boolean parentLast) {
+ processParentLast = parentLast;
+ }
+
+ public boolean processParentLast() {
+ return processParentLast;
+ }
+
+ public int getCommand() {
+ return command;
+ }
+
+ public void setCommand(int command) {
+ this.command = command;
+ }
+
+ public void setNoConsumers(boolean trueOrFalse) {
+ noConsumers = trueOrFalse;
+ }
+
+ public void setReplyEndpoint(boolean tORf) {
+ isReplyEndpointFlag = tORf;
+ }
+
+ public boolean isReplyEndpoint() {
+ return isReplyEndpointFlag;
+ }
+
+ public boolean remove() {
+ return remove;
+
+ }
+
+ public void setRemove(boolean rm) {
+ remove = rm;
+ }
+
+ public boolean hasNoConsumers() {
+ return noConsumers;
+ }
+
+ public String getReplyToEndpoint() {
+ return replyTo;
+ }
+
+ public void setReplyToEndpoint(String anEndpointName) {
+ replyTo = anEndpointName;
+ }
+
+ public boolean completedProcessingCollection() {
+ return completedProcessingCollection;
+ }
+
+ public void setCompletedProcessingCollection(boolean completed) {
+ completedProcessingCollection = completed;
+ }
+
+ public void setHighWaterMark(String aHighWaterMark) {
+ highWaterMark = aHighWaterMark;
+ }
+
+ public String getHighWaterMark() {
+ return highWaterMark;
+ }
+
+ public boolean isRetryEnabled() {
+ return retryEnabled;
+ }
+
+ public void setRetryEnabled(boolean retryEnabled) {
+ this.retryEnabled = retryEnabled;
+ }
+
+ public void setController(AnalysisEngineController aController) {
+ controller = aController;
+ }
+
+ public void startCheckpointTimer() {
+ checkpointTimer = System.nanoTime();
+ }
+
+ public long getCheckpointTimer() {
+ return checkpointTimer;
+ }
+
+ public long getEntryTime() {
+ return timeIn;
+ }
+
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new InternalError(e.toString());
+ }
+ }
+
+ public String getSerializer() {
+ return serializer;
+ }
+
+ public boolean isFinal() {
+ return finalEndpoint;
+ }
+
+ public void setFinal(boolean isFinal) {
+ finalEndpoint = isFinal;
+ }
+
+ public void setSerializer(String serializer) {
+ if (serializer != null && serializer.trim().length() > 0) {
this.serializer = serializer;
- }
- }
+ }
+ }
+
+ public int getMetadataRequestTimeout() {
+ return metadataRequestTimeout;
+ }
+
+ public void setMetadataRequestTimeout(int metadataRequestTimeout) {
+ this.metadataRequestTimeout = metadataRequestTimeout;
+ }
+
+ public int getProcessRequestTimeout() {
+ return processRequestTimeout;
+ }
+
+ public void setProcessRequestTimeout(int processRequestTimeout) {
+ this.processRequestTimeout = processRequestTimeout;
+ }
+
+ public void setCollectionProcessCompleteTimeout(int cpcTimeout) {
+ this.collectionProcessCompleteTimeout = cpcTimeout;
+ }
+
+ public int getCollectionProcessCompleteTimeout() {
+ return collectionProcessCompleteTimeout;
+ }
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ public void setInitialized(boolean initialized) {
+ this.initialized = initialized;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public String getServerURI() {
+ return serverURI;
+ }
+
+ public void setServerURI(String aServerURI) {
+ this.serverURI = aServerURI;
+ if (aServerURI != null && aServerURI.startsWith("vm:") == true) {
+ setRemote(false);
+ } else {
+ setRemote(true);
+ }
+ }
+
+ public void setWaitingForResponse(boolean isWaiting) {
+ waitingForResponse = isWaiting;
+
+ }
+
+ private void startTimer(final int aTimeToWait, String aCasReferenceId, int command) {
+ /*
+ * synchronized( monitor ) { final String casReferenceId = aCasReferenceId; final int cmd =
+ * command; Date timeToRun = new Date(System.currentTimeMillis() + aTimeToWait);
+ *
+ *
+ * setWaitingForResponse(true); // timer = new Timer();
+ *
+ *
+ * if ( controller != null ) { timer = new
+ * Timer("Controller:"+controller.getComponentName()+":TimerThread-Endpoint_impl:"
+ * +endpoint+":"+System.nanoTime()+":Cmd:"+cmd); } else { timer = new
+ * Timer("TimerThread-Endpoint_impl:"+endpoint+":"+System.nanoTime()+":Cmd:"+cmd); }
+ *
+ *
+ * timer.schedule(new TimerTask() { public void run() { if ( AsynchAEMessage.Process == cmd ) {
+ * if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+ * UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, this.getClass().getName(),
+ * "TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ * "UIMAEE_cas_timeout_no_reply__INFO", new Object[] { endpoint, aTimeToWait, casReferenceId });
+ * } } else if ( AsynchAEMessage.GetMeta == cmd ) { if
+ * (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+ * UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, this.getClass().getName(),
+ * "TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ * "UIMAEE_meta_timeout_no_reply__INFO", new Object[] { endpoint, aTimeToWait }); } } else { if
+ * (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+ * UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, this.getClass().getName(),
+ * "TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+ * "UIMAEE_cpc_timeout_no_reply__INFO", new Object[] { endpoint, aTimeToWait }); }
+ *
+ * }
+ *
+ * waitingForResponse = false; if ( timer != null ) { timer.cancel(); timer.purge(); }
+ *
+ * if ( controller != null ) {
+ *
+ * ErrorContext errorContext = new ErrorContext(); if ( casReferenceId != null ) {
+ * errorContext.add(AsynchAEMessage.CasReference, String.valueOf(casReferenceId)); }
+ * errorContext.add(AsynchAEMessage.Command, cmd); errorContext.add(AsynchAEMessage.Endpoint,
+ * selfRef); if ( controller != null && controller.getErrorHandlerChain() != null ) { // Handle
+ * Timeout controller.getErrorHandlerChain().handle(new MessageTimeoutException(), errorContext,
+ * controller); } } } }, timeToRun); }
+ */
+ }
+
+ public ServiceInfo getServiceInfo() {
+ if (serviceInfo == null) {
+ serviceInfo = new ServiceInfo(isCasMultiplier);
+ serviceInfo.setBrokerURL(serverURI);
+ serviceInfo.setInputQueueName(endpoint);
+ serviceInfo.setState("Active");
+ }
+ return serviceInfo;
+ }
+
+ public void startProcessRequestTimer(String aCasReferenceId) {
+ if (getProcessRequestTimeout() > 0) {
+ startTimer(processRequestTimeout, aCasReferenceId, AsynchAEMessage.Process);
+ } else {
+ setWaitingForResponse(true);
+ }
+
+ }
+
+ public void startMetadataRequestTimer() {
+ if (getMetadataRequestTimeout() > 0) {
+ startTimer(metadataRequestTimeout, null, AsynchAEMessage.GetMeta);
+ } else {
+ setWaitingForResponse(true);
+ }
+ }
+
+ public void startCollectionProcessCompleteTimer() {
+ if (getCollectionProcessCompleteTimeout() > 0) {
+ startTimer(collectionProcessCompleteTimeout, null, AsynchAEMessage.CollectionProcessComplete);
+ } else {
+ setWaitingForResponse(true);
+ }
+
+ }
+
+ public void cancelTimer() {
+ /*
+ * synchronized( monitor ) { if (timer != null) { waitingForResponse = false; timer.cancel();
+ * timer = null; } }
+ */
+ }
+
+ public boolean isWaitingForResponse() {
+
+ return waitingForResponse;
+ }
+
+ public boolean isRemote() {
+ return isRemote;
+ }
+
+ public void setRemote(boolean aRemote) {
+ isRemote = aRemote;
+
+ }
+
+ public String getDescriptor() {
+ return descriptor;
+ }
+
+ public void setDescriptor(String aDescriptor) {
+ descriptor = aDescriptor;
+ }
+
+ public void initialize() throws AsynchAEException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean isOpen() {
+ return true;
+ }
+
+ public void close() {
+
+ }
+
+ public boolean isCasMultiplier() {
+ return isCasMultiplier;
+ }
+
+ public void setIsCasMultiplier(boolean trueORfalse) {
+ isCasMultiplier = trueORfalse;
+ if (isCasMultiplier) {
+ getServiceInfo().setCASMultiplier();
+ }
+ }
+
+ public void setShadowCasPoolSize(int aPoolSize) {
+ shadowCasPoolSize = aPoolSize;
+ }
+
+ public int getShadowPoolSize() {
+ return shadowCasPoolSize;
+ }
+
+ public Object getDestination() {
+ return destination;
+ }
+
+ public void setDestination(Object aDestination) {
+ destination = aDestination;
+ }
+
+ public void setRegisteredWithParent() {
+ registeredWithParent = true;
+ }
+
+ public boolean isRegisteredWithParent() {
+ return registeredWithParent;
+ }
+
+ public void setInitialFsHeapSize(int aHeapSize) {
+ initialHeapSize = aHeapSize;
+ }
+
+ public void setTempReplyDestination(boolean isTempReplyDestination) {
+ tempReplyDestination = isTempReplyDestination;
+ }
+
+ public boolean isTempReplyDestination() {
+ return tempReplyDestination;
+ }
+
+ public void setReplyDestinationFailed() {
+ replyDestinationFailed = true;
+ }
+
+ public boolean replyDestinationFailed() {
+ return replyDestinationFailed;
+ }
+
+ public long getIdleTime() {
+ return idleTime;
+ }
+
+ public void setIdleTime(long idleTime) {
+ this.idleTime = idleTime;
+ }
+
+ /*
+ * Print name of the endpoint rather than class hash code
+ */
+ public String toString() {
+ return endpoint;
+ }
+
+ public void setEndpointServer(String anEndpointServer) {
+ endpointServer = anEndpointServer;
+ }
+
+ public String getEndpointServer() {
+ return endpointServer;
+ }
- public int getMetadataRequestTimeout()
- {
- return metadataRequestTimeout;
- }
-
- public void setMetadataRequestTimeout(int metadataRequestTimeout)
- {
- this.metadataRequestTimeout = metadataRequestTimeout;
- }
-
- public int getProcessRequestTimeout()
- {
- return processRequestTimeout;
- }
-
- public void setProcessRequestTimeout(int processRequestTimeout)
- {
- this.processRequestTimeout = processRequestTimeout;
- }
-
- public void setCollectionProcessCompleteTimeout(int cpcTimeout)
- {
- this.collectionProcessCompleteTimeout = cpcTimeout;
- }
-
- public int getCollectionProcessCompleteTimeout()
- {
- return collectionProcessCompleteTimeout;
- }
- public boolean isInitialized()
- {
- return initialized;
- }
-
- public void setInitialized(boolean initialized)
- {
- this.initialized = initialized;
- }
-
- public String getEndpoint()
- {
- return endpoint;
- }
-
- public void setEndpoint(String endpoint)
- {
- this.endpoint = endpoint;
- }
-
- public String getServerURI()
- {
- return serverURI;
- }
-
- public void setServerURI(String aServerURI)
- {
- this.serverURI = aServerURI;
- if ( aServerURI != null && aServerURI.startsWith("vm:") == true )
- {
- setRemote(false);
- }
- else
- {
- setRemote(true);
- }
- }
- public void setWaitingForResponse(boolean isWaiting)
- {
- waitingForResponse = isWaiting;
-
- }
-
- private void startTimer(final int aTimeToWait, String aCasReferenceId, int command)
- {
- /*
- synchronized( monitor )
- {
- final String casReferenceId = aCasReferenceId;
- final int cmd = command;
- Date timeToRun = new Date(System.currentTimeMillis() + aTimeToWait);
-
-
- setWaitingForResponse(true);
-// timer = new Timer();
-
-
- if ( controller != null )
- {
- timer = new Timer("Controller:"+controller.getComponentName()+":TimerThread-Endpoint_impl:"+endpoint+":"+System.nanoTime()+":Cmd:"+cmd);
- }
- else
- {
- timer = new Timer("TimerThread-Endpoint_impl:"+endpoint+":"+System.nanoTime()+":Cmd:"+cmd);
- }
-
-
- timer.schedule(new TimerTask() {
- public void run()
- {
- if ( AsynchAEMessage.Process == cmd )
- {
- if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, this.getClass().getName(),
- "TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_cas_timeout_no_reply__INFO",
- new Object[] { endpoint, aTimeToWait, casReferenceId });
- }
- }
- else if ( AsynchAEMessage.GetMeta == cmd )
- {
- if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, this.getClass().getName(),
- "TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_meta_timeout_no_reply__INFO",
- new Object[] { endpoint, aTimeToWait });
- }
- }
- else
- {
- if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, this.getClass().getName(),
- "TimerTask.run", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_cpc_timeout_no_reply__INFO",
- new Object[] { endpoint, aTimeToWait });
- }
-
- }
-
- waitingForResponse = false;
- if ( timer != null )
- {
- timer.cancel();
- timer.purge();
- }
-
- if ( controller != null )
- {
-
- ErrorContext errorContext = new ErrorContext();
- if ( casReferenceId != null )
- {
- errorContext.add(AsynchAEMessage.CasReference, String.valueOf(casReferenceId));
- }
- errorContext.add(AsynchAEMessage.Command, cmd);
- errorContext.add(AsynchAEMessage.Endpoint, selfRef);
- if ( controller != null && controller.getErrorHandlerChain() != null )
- {
- // Handle Timeout
- controller.getErrorHandlerChain().handle(new MessageTimeoutException(), errorContext, controller);
- }
- }
- }
- }, timeToRun);
- }
-*/
- }
- public ServiceInfo getServiceInfo()
- {
- if ( serviceInfo == null )
- {
- serviceInfo = new ServiceInfo(isCasMultiplier);
- serviceInfo.setBrokerURL(serverURI);
- serviceInfo.setInputQueueName(endpoint);
- serviceInfo.setState("Active");
- }
- return serviceInfo;
- }
- public void startProcessRequestTimer(String aCasReferenceId)
- {
- if ( getProcessRequestTimeout() > 0 )
- {
- startTimer(processRequestTimeout, aCasReferenceId, AsynchAEMessage.Process);
- }
- else
- {
- setWaitingForResponse(true);
- }
-
- }
-
- public void startMetadataRequestTimer()
- {
- if ( getMetadataRequestTimeout() > 0 )
- {
- startTimer(metadataRequestTimeout, null, AsynchAEMessage.GetMeta);
- }
- else
- {
- setWaitingForResponse(true);
- }
- }
-
- public void startCollectionProcessCompleteTimer()
- {
- if ( getCollectionProcessCompleteTimeout() > 0 )
- {
- startTimer(collectionProcessCompleteTimeout, null, AsynchAEMessage.CollectionProcessComplete);
- }
- else
- {
- setWaitingForResponse(true);
- }
-
- }
-
- public void cancelTimer()
- {
- /*
- synchronized( monitor )
- {
- if (timer != null)
- {
- waitingForResponse = false;
- timer.cancel();
- timer = null;
- }
- }
- */
- }
-
- public boolean isWaitingForResponse()
- {
-
- return waitingForResponse;
- }
-
- public boolean isRemote()
- {
- return isRemote;
- }
-
- public void setRemote(boolean aRemote)
- {
- isRemote = aRemote;
-
- }
-
- public String getDescriptor()
- {
- return descriptor;
- }
-
- public void setDescriptor(String aDescriptor)
- {
- descriptor = aDescriptor;
- }
-
- public void initialize() throws AsynchAEException
- {
- // TODO Auto-generated method stub
-
- }
-
- public boolean isOpen()
- {
- return true;
- }
- public void close()
- {
-
- }
- public boolean isCasMultiplier()
- {
- return isCasMultiplier;
- }
-
- public void setIsCasMultiplier(boolean trueORfalse)
- {
- isCasMultiplier = trueORfalse;
- if ( isCasMultiplier ) {
- getServiceInfo().setCASMultiplier();
- }
- }
- public void setShadowCasPoolSize( int aPoolSize )
- {
- shadowCasPoolSize = aPoolSize;
- }
-
- public int getShadowPoolSize()
- {
- return shadowCasPoolSize;
- }
-
- public Object getDestination()
- {
- return destination;
- }
- public void setDestination( Object aDestination)
- {
- destination = aDestination;
- }
- public void setRegisteredWithParent()
- {
- registeredWithParent = true;
- }
-
- public boolean isRegisteredWithParent()
- {
- return registeredWithParent;
- }
- public void setInitialFsHeapSize(int aHeapSize)
- {
- initialHeapSize = aHeapSize;
- }
- public void setTempReplyDestination(boolean isTempReplyDestination )
- {
- tempReplyDestination = isTempReplyDestination;
- }
-
- public boolean isTempReplyDestination()
- {
- return tempReplyDestination;
- }
- public void setReplyDestinationFailed()
- {
- replyDestinationFailed = true;
- }
-
- public boolean replyDestinationFailed()
- {
- return replyDestinationFailed;
- }
-
- public long getIdleTime() {
- return idleTime;
- }
-
- public void setIdleTime(long idleTime) {
- this.idleTime = idleTime;
- }
-
- /*
- * Print name of the endpoint rather than class hash code
- */
- public String toString() {
- return endpoint;
- }
-
- public void setEndpointServer( String anEndpointServer ){
- endpointServer = anEndpointServer;
- }
-
- public String getEndpointServer() {
- return endpointServer;
- }
-
public void setConcurrentRequestConsumers(int aConsumerCount) {
concurrentRequestConsumers = aConsumerCount;
}
-
+
public int getConcurrentRequestConsumers() {
return concurrentRequestConsumers;
}
- public void setConcurrentReplyConsumers(int aConsumerCount) {
+ public void setConcurrentReplyConsumers(int aConsumerCount) {
concurrentReplyConsumers = aConsumerCount;
-
+
}
-
+
public int getConcurrentReplyConsumers() {
return concurrentReplyConsumers;
}
- public void setStatus( int aStatus) {
+
+ public void setStatus(int aStatus) {
status = aStatus;
}
-
+
public int getStatus() {
return status;
}
- public void setDelegateKey( String aDelegateKey ) {
+ public void setDelegateKey(String aDelegateKey) {
delegateKey = aDelegateKey;
}
-
+
public String getDelegateKey() {
return delegateKey;
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/EventSubscriber.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/EventSubscriber.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/EventSubscriber.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/EventSubscriber.java Wed Sep 2 15:22:13 2009
@@ -19,7 +19,6 @@
package org.apache.uima.aae.controller;
-public interface EventSubscriber
-{
- public void onCacheEmpty();
+public interface EventSubscriber {
+ public void onCacheEmpty();
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/FlowControllerImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/FlowControllerImpl.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/FlowControllerImpl.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/FlowControllerImpl.java Wed Sep 2 15:22:13 2009
@@ -31,75 +31,66 @@
import org.apache.uima.flow.Step;
import org.apache.uima.resource.ResourceInitializationException;
-public class FlowControllerImpl extends FlowController_ImplBase
-{
- String[] mSequence;
- public FlowControllerImpl()
- {
-
- }
- public FlowControllerImpl(FlowControllerContext fcContext) throws ResourceInitializationException
- {
- super.initialize(fcContext);
- }
-
- public void setKeys( String[] keys )
- {
- mSequence = keys;
- }
- public void init() throws Exception
- {
-
- }
-
- public Flow computeFlow(AbstractCas arg0) throws AnalysisEngineProcessException
- {
- return new FixedFlowObject(0);
- }
-
- public Class getRequiredCasInterface()
- {
- return null;
- }
- class FixedFlowObject extends CasFlow_ImplBase
- {
- private int currentStep;
- private boolean wasSegmented = false;
-
- public FixedFlowObject(int startStep)
- {
- currentStep = startStep;
- }
-
- public Step next() throws AnalysisEngineProcessException
- {
- if (currentStep >= mSequence.length)
- {
- return new FinalStep(); //this CAS has finished the sequence
- }
- //If CAS was segmented, do not continue with flow. The individual segments
- //are processed further but the original CAS is not.
- //TODO: should be configurable.
- if (wasSegmented)
- {
- return new FinalStep();
- }
-
- //otherwise, we just send the CAS to the next AE in sequence.
- return new SimpleStep(mSequence[currentStep++]);
- }
-
- public Flow newCasProduced(CAS newCas, String producedBy) throws AnalysisEngineProcessException
- {
- //record that the input CAS has been segmented (affects its subsequent flow)
- wasSegmented = true;
- //start the new output CAS from the next node after the CasMultiplier that produced it
- int i = 0;
- while (!mSequence[i].equals(producedBy))
- i++;
- return new FixedFlowObject(i+1);
- }
- }
+public class FlowControllerImpl extends FlowController_ImplBase {
+ String[] mSequence;
+ public FlowControllerImpl() {
+
+ }
+
+ public FlowControllerImpl(FlowControllerContext fcContext) throws ResourceInitializationException {
+ super.initialize(fcContext);
+ }
+
+ public void setKeys(String[] keys) {
+ mSequence = keys;
+ }
+
+ public void init() throws Exception {
+
+ }
+
+ public Flow computeFlow(AbstractCas arg0) throws AnalysisEngineProcessException {
+ return new FixedFlowObject(0);
+ }
+
+ public Class getRequiredCasInterface() {
+ return null;
+ }
+
+ class FixedFlowObject extends CasFlow_ImplBase {
+ private int currentStep;
+
+ private boolean wasSegmented = false;
+
+ public FixedFlowObject(int startStep) {
+ currentStep = startStep;
+ }
+
+ public Step next() throws AnalysisEngineProcessException {
+ if (currentStep >= mSequence.length) {
+ return new FinalStep(); // this CAS has finished the sequence
+ }
+ // If CAS was segmented, do not continue with flow. The individual segments
+ // are processed further but the original CAS is not.
+ // TODO: should be configurable.
+ if (wasSegmented) {
+ return new FinalStep();
+ }
+
+ // otherwise, we just send the CAS to the next AE in sequence.
+ return new SimpleStep(mSequence[currentStep++]);
+ }
+
+ public Flow newCasProduced(CAS newCas, String producedBy) throws AnalysisEngineProcessException {
+ // record that the input CAS has been segmented (affects its subsequent flow)
+ wasSegmented = true;
+ // start the new output CAS from the next node after the CasMultiplier that produced it
+ int i = 0;
+ while (!mSequence[i].equals(producedBy))
+ i++;
+ return new FixedFlowObject(i + 1);
+ }
+ }
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/LocalCache.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/LocalCache.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/LocalCache.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/LocalCache.java Wed Sep 2 15:22:13 2009
@@ -16,32 +16,35 @@
public class LocalCache extends ConcurrentHashMap<String, LocalCache.CasStateEntry> {
private static final long serialVersionUID = 1L;
+
private static final Class CLASS_NAME = LocalCache.class;
private AnalysisEngineController controller;
-
+
public LocalCache(AnalysisEngineController aController) {
controller = aController;
}
- public CasStateEntry createCasStateEntry( String aCasReferenceId ) {
- CasStateEntry entry = new CasStateEntry( aCasReferenceId );
- super.put( aCasReferenceId, entry);
+
+ public CasStateEntry createCasStateEntry(String aCasReferenceId) {
+ CasStateEntry entry = new CasStateEntry(aCasReferenceId);
+ super.put(aCasReferenceId, entry);
return entry;
}
- public CasStateEntry lookupEntry( String aCasReferenceId ) {
- if ( super.containsKey(aCasReferenceId)) {
+
+ public CasStateEntry lookupEntry(String aCasReferenceId) {
+ if (super.containsKey(aCasReferenceId)) {
return super.get(aCasReferenceId);
}
return null;
}
-
+
public String lookupInputCasReferenceId(String aCasReferenceId) {
- String parentCasReferenceId=null;
- if ( this.containsKey(aCasReferenceId)) {
- CasStateEntry entry = (CasStateEntry)get(aCasReferenceId);
- if ( entry != null && entry.isSubordinate()) {
- // recursively call each parent until we get to the top of the
- // Cas hierarchy
+ String parentCasReferenceId = null;
+ if (this.containsKey(aCasReferenceId)) {
+ CasStateEntry entry = (CasStateEntry) get(aCasReferenceId);
+ if (entry != null && entry.isSubordinate()) {
+ // recursively call each parent until we get to the top of the
+ // Cas hierarchy
parentCasReferenceId = lookupInputCasReferenceId(entry.getInputCasReferenceId());
} else {
return aCasReferenceId;
@@ -51,244 +54,282 @@
}
public String lookupInputCasReferenceId(CasStateEntry entry) {
- String parentCasReferenceId=null;
- if ( entry.isSubordinate()) {
- // recursively call each parent until we get to the top of the
- // Cas hierarchy
- parentCasReferenceId =
- lookupInputCasReferenceId((CasStateEntry)get(entry.getInputCasReferenceId()));
+ String parentCasReferenceId = null;
+ if (entry.isSubordinate()) {
+ // recursively call each parent until we get to the top of the
+ // Cas hierarchy
+ parentCasReferenceId = lookupInputCasReferenceId((CasStateEntry) get(entry
+ .getInputCasReferenceId()));
} else {
return entry.getCasReferenceId();
}
return parentCasReferenceId;
}
-
+
public synchronized void dumpContents() {
- int count=0;
- if ( UIMAFramework.getLogger().isLoggable(Level.FINEST) )
- {
+ int count = 0;
+ if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
StringBuffer sb = new StringBuffer("\n");
-
- for( Iterator it = entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry)it.next();
- CasStateEntry casStateEntry = (CasStateEntry)entry.getValue();
- if ( casStateEntry == null ) {
+ for (Iterator it = entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ CasStateEntry casStateEntry = (CasStateEntry) entry.getValue();
+ if (casStateEntry == null) {
continue;
}
count++;
- if ( casStateEntry.isSubordinate())
- {
- sb.append(entry.getKey()+ " Number Of Child CASes In Play:"+casStateEntry.getSubordinateCasInPlayCount()+" Parent CAS id:"+casStateEntry.getInputCasReferenceId());
- }
- else
- {
- sb.append(entry.getKey()+ " *** Input CAS. Number Of Child CASes In Play:"+casStateEntry.getSubordinateCasInPlayCount());
+ if (casStateEntry.isSubordinate()) {
+ sb.append(entry.getKey() + " Number Of Child CASes In Play:"
+ + casStateEntry.getSubordinateCasInPlayCount() + " Parent CAS id:"
+ + casStateEntry.getInputCasReferenceId());
+ } else {
+ sb.append(entry.getKey() + " *** Input CAS. Number Of Child CASes In Play:"
+ + casStateEntry.getSubordinateCasInPlayCount());
}
- if ( casStateEntry.isWaitingForRelease() )
- {
- sb.append(" <<< Reached Final State in Controller:"+controller.getComponentName());
+ if (casStateEntry.isWaitingForRelease()) {
+ sb.append(" <<< Reached Final State in Controller:" + controller.getComponentName());
}
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[] { controller.getComponentName(), count, sb.toString() });
+ 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[] { controller.getComponentName(), count, sb.toString() });
sb.setLength(0);
- }
- else if ( UIMAFramework.getLogger().isLoggable(Level.FINE) )
- {
- int inFinalState=0;
-
- for( Iterator it = entrySet().iterator(); it.hasNext(); ) {
- Map.Entry entry = (Map.Entry)it.next();
- CasStateEntry casStateEntry = (CasStateEntry)entry.getValue();
+ } else if (UIMAFramework.getLogger().isLoggable(Level.FINE)) {
+ int inFinalState = 0;
+
+ for (Iterator it = entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ CasStateEntry casStateEntry = (CasStateEntry) entry.getValue();
count++;
- if ( casStateEntry != null && casStateEntry.isWaitingForRelease() )
- {
+ if (casStateEntry != null && casStateEntry.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[] { controller.getComponentName(), count, 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[] { controller.getComponentName(), count, inFinalState });
+
}
-
+
}
- public synchronized void remove(String aCasReferenceId)
- {
- if (aCasReferenceId != null && containsKey(aCasReferenceId))
- {
-
+
+ public synchronized void remove(String aCasReferenceId) {
+ if (aCasReferenceId != null && 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 });
}
super.remove(aCasReferenceId);
this.notifyAll();
- }
- else if ( aCasReferenceId == null )
- {
+ } 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 });
}
}
}
- public CasStateEntry getTopCasAncestor( String casReferenceId ) throws Exception
- {
- if ( !containsKey(casReferenceId) ) {
+
+ public CasStateEntry getTopCasAncestor(String casReferenceId) throws Exception {
+ if (!containsKey(casReferenceId)) {
return null;
}
CasStateEntry casStateEntry = lookupEntry(casReferenceId);
- if ( casStateEntry.isSubordinate() )
- {
- // Recurse until the top CAS reference Id is found
+ if (casStateEntry.isSubordinate()) {
+ // Recurse until the top CAS reference Id is found
return getTopCasAncestor(casStateEntry.getInputCasReferenceId());
}
- // Return the top ancestor CAS id
+ // Return the top ancestor CAS id
return casStateEntry;
}
public static class CasStateEntry {
-
+
private String casReferenceId;
+
private volatile boolean waitingForRealease;
- private volatile boolean pendingReply;
+
+ private volatile boolean pendingReply;
+
private volatile boolean subordinateCAS;
+
private volatile boolean replyReceived;
+
private volatile boolean failed;
+
private volatile boolean dropped;
-
- private List<Throwable> exceptionList = new ArrayList<Throwable>();
+
+ private List<Throwable> exceptionList = new ArrayList<Throwable>();
+
private FinalStep step;
+
private int state;
+
private int subordinateCasInPlayCount;
+
private Object childCountMux = new Object();
+
private String inputCasReferenceId;
+
private int numberOfParallelDelegates = 1;
- private Delegate lastDelegate = null;
+
+ private Delegate lastDelegate = null;
+
private int howManyDelegatesResponded = 0;
+
private Endpoint freeCasNotificationEndpoint;
public boolean isDropped() {
return dropped;
}
+
public void setDropped(boolean dropped) {
this.dropped = dropped;
}
-
+
public Endpoint getFreeCasNotificationEndpoint() {
return freeCasNotificationEndpoint;
}
+
public void setFreeCasNotificationEndpoint(Endpoint freeCasNotificationEndpoint) {
this.freeCasNotificationEndpoint = freeCasNotificationEndpoint;
}
- public CasStateEntry( String aCasReferenceId ) {
+
+ public CasStateEntry(String aCasReferenceId) {
casReferenceId = aCasReferenceId;
}
- public void setLastDelegate( Delegate aDelegate) {
+
+ public void setLastDelegate(Delegate aDelegate) {
lastDelegate = aDelegate;
}
+
public Delegate getLastDelegate() {
return lastDelegate;
}
+
public String getCasReferenceId() {
return casReferenceId;
}
+
public String getInputCasReferenceId() {
return inputCasReferenceId;
}
+
public void setInputCasReferenceId(String anInputCasReferenceId) {
inputCasReferenceId = anInputCasReferenceId;
subordinateCAS = true;
}
+
public void setWaitingForRelease(boolean flag) {
waitingForRealease = flag;
}
+
public boolean isWaitingForRelease() {
return waitingForRealease;
}
- public void setFinalStep( FinalStep step ) {
+
+ public void setFinalStep(FinalStep step) {
this.step = step;
}
+
public FinalStep getFinalStep() {
return step;
}
+
public int getState() {
return state;
}
- public void setState( int aState ) {
+
+ public void setState(int aState) {
state = aState;
}
+
public boolean isSubordinate() {
return subordinateCAS;
}
+
public int getSubordinateCasInPlayCount() {
- synchronized( childCountMux ) {
+ synchronized (childCountMux) {
return subordinateCasInPlayCount;
}
}
+
public void incrementSubordinateCasInPlayCount() {
- synchronized( childCountMux ) {
+ synchronized (childCountMux) {
subordinateCasInPlayCount++;
}
}
+
public int decrementSubordinateCasInPlayCount() {
- synchronized( childCountMux ) {
- if ( subordinateCasInPlayCount > 0) {
+ synchronized (childCountMux) {
+ if (subordinateCasInPlayCount > 0) {
subordinateCasInPlayCount--;
}
return subordinateCasInPlayCount;
}
}
+
public boolean isPendingReply() {
return pendingReply;
}
+
public void setPendingReply(boolean pendingReply) {
this.pendingReply = pendingReply;
}
+
public void setReplyReceived() {
replyReceived = true;
}
+
public boolean isReplyReceived() {
return replyReceived;
}
- public synchronized void incrementHowManyDelegatesResponded(){
- if ( howManyDelegatesResponded < numberOfParallelDelegates) {
+
+ public synchronized void incrementHowManyDelegatesResponded() {
+ if (howManyDelegatesResponded < numberOfParallelDelegates) {
howManyDelegatesResponded++;
}
}
- public synchronized int howManyDelegatesResponded(){
+
+ public synchronized int howManyDelegatesResponded() {
return howManyDelegatesResponded;
}
-
- public synchronized void resetDelegateResponded(){
+
+ public synchronized void resetDelegateResponded() {
howManyDelegatesResponded = 0;
}
- public void setNumberOfParallelDelegates( int aNumberOfParallelDelegates ) {
+
+ public void setNumberOfParallelDelegates(int aNumberOfParallelDelegates) {
numberOfParallelDelegates = aNumberOfParallelDelegates;
}
-
+
public int getNumberOfParallelDelegates() {
return numberOfParallelDelegates;
}
+
public boolean isFailed() {
return failed;
}
+
public void setFailed() {
this.failed = true;
}
- public void addThrowable( Throwable t ) {
+
+ public void addThrowable(Throwable t) {
exceptionList.add(t);
}
+
public List<Throwable> getErrors() {
return exceptionList;
}
Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController.java?rev=810557&r1=810556&r2=810557&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController.java Wed Sep 2 15:22:13 2009
@@ -23,13 +23,16 @@
import org.apache.uima.aae.jmx.ServiceInfo;
import org.apache.uima.resource.ResourceInitializationException;
+public interface PrimitiveAnalysisEngineController extends AnalysisEngineController {
+ public void setAnalysisEngineInstancePool(AnalysisEngineInstancePool aPool);
-public interface PrimitiveAnalysisEngineController extends AnalysisEngineController
-{
- public void setAnalysisEngineInstancePool( AnalysisEngineInstancePool aPool);
- public PrimitiveServiceInfo getServiceInfo();
- public void addAbortedCasReferenceId( String aCasReferenceId );
- public int getAEInstanceCount();
- public void initializeAnalysisEngine() throws ResourceInitializationException;
- public boolean threadAssignedToAE();
+ public PrimitiveServiceInfo getServiceInfo();
+
+ public void addAbortedCasReferenceId(String aCasReferenceId);
+
+ public int getAEInstanceCount();
+
+ public void initializeAnalysisEngine() throws ResourceInitializationException;
+
+ public boolean threadAssignedToAE();
}