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 2013/08/07 18:56:56 UTC

svn commit: r1511395 - /uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java

Author: cwiklik
Date: Wed Aug  7 16:56:55 2013
New Revision: 1511395

URL: http://svn.apache.org/r1511395
Log:
UIMA-3155 Modified to support optional timerPerCAS

Modified:
    uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java

Modified: uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java?rev=1511395&r1=1511394&r2=1511395&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java (original)
+++ uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java Wed Aug  7 16:56:55 2013
@@ -255,6 +255,10 @@ public abstract class BaseUIMAAsynchrono
   
   abstract protected void initializeConsumer(String aBrokerURI, Connection connection) throws Exception;
 
+  // enables/disable timer per CAS. Defaul is to use single timer for
+  // all outstanding CASes
+  protected volatile boolean timerPerCAS=false;
+  
   //abstract protected  String getBrokerURI();
 
   protected void setBrokeryURI(String brokerURI ) {
@@ -912,7 +916,7 @@ public abstract class BaseUIMAAsynchrono
         	  // since the service is in time out state, we dont send CASes to it just yet. Instead, place
         	  // a CAS in a pending dispatch list. CASes from this list will be sent once a response to PING
         	  // arrives.
-            serviceDelegate.addCasToPendingDispatchList(requestToCache.getCasReferenceId(), aCAS.hashCode());
+            serviceDelegate.addCasToPendingDispatchList(requestToCache.getCasReferenceId(), aCAS.hashCode(), timerPerCAS); 
             if ( cpcReadySemaphore.availablePermits() > 0 ) {
               acquireCpcReadySemaphore();
             }
@@ -943,7 +947,7 @@ public abstract class BaseUIMAAsynchrono
         	  // since the service is in time out state, we dont send CASes to it just yet. Instead, place
         	  // a CAS in a pending dispatch list. CASes from this list will be sent once a response to PING
         	  // arrives.
-              serviceDelegate.addCasToPendingDispatchList(requestToCache.getCasReferenceId(), aCAS.hashCode());
+              serviceDelegate.addCasToPendingDispatchList(requestToCache.getCasReferenceId(), aCAS.hashCode(), timerPerCAS);
               return casReferenceId;
             }
           }
@@ -983,7 +987,7 @@ public abstract class BaseUIMAAsynchrono
   public boolean delayCasIfDelegateInTimedOutState(String aCasReferenceId, long casHashcode) throws AsynchAEException {
     if (serviceDelegate != null && serviceDelegate.getState() == Delegate.TIMEOUT_STATE) {
       // Add CAS id to the list of delayed CASes.
-      serviceDelegate.addCasToPendingDispatchList(aCasReferenceId, casHashcode);
+      serviceDelegate.addCasToPendingDispatchList(aCasReferenceId, casHashcode, timerPerCAS); 
       return true;
     }
     return false; // Cas Not Delayed
@@ -1081,7 +1085,7 @@ public abstract class BaseUIMAAsynchrono
     	  serviceDelegate.restartTimerForOldestCasInOutstandingList();
           //	We got a reply to GetMeta ping. Send all CASes that have been
           //    placed on the pending dispatch queue to a service.
-    	  while( (casReferenceId = serviceDelegate.removeOldestFromPendingDispatchList()) != null ) {
+    	  while( serviceDelegate.getState()==Delegate.OK_STATE && (casReferenceId = serviceDelegate.removeOldestFromPendingDispatchList()) != null ) {
     	        ClientRequest cachedRequest = (ClientRequest) clientCache.get(casReferenceId);
     	        if (cachedRequest != null) {
     	          if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {