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/01/22 22:25:01 UTC

svn commit: r736798 - /incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/delegate/Delegate.java

Author: cwiklik
Date: Thu Jan 22 13:25:01 2009
New Revision: 736798

URL: http://svn.apache.org/viewvc?rev=736798&view=rev
Log:
UIMA-1127 Fixed how Ping Timeout is Handled

Modified:
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/delegate/Delegate.java

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/delegate/Delegate.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/delegate/Delegate.java?rev=736798&r1=736797&r2=736798&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/delegate/Delegate.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/delegate/Delegate.java Thu Jan 22 13:25:01 2009
@@ -416,6 +416,12 @@
       return outstandingCasList.remove(0).getCasReferenceId();
     }
   }
+  
+  public String getOldestCasIdFromOutstandingList() {
+    synchronized (outstandingCasListMux) {
+      return outstandingCasList.get(0).getCasReferenceId();
+    }
+  }
   /**
    * Removes {@link DelegateEntry} from the list of CASes pending reply. If the CAS removed was the
    * oldest in the list (first in the list) AND there are other CASes in the list pending reply AND
@@ -549,6 +555,7 @@
         cancelDelegateTimer();
         delegate.setState(TIMEOUT_STATE);
         ErrorContext errorContext = new ErrorContext();
+        errorContext.add(AsynchAEMessage.Command, aCommand);
 
         if (AsynchAEMessage.Process == aCommand) {
           if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
@@ -565,6 +572,16 @@
                     "UIMAEE_meta_timeout_no_reply__INFO",
                     new Object[] { delegate.getKey(), timeToWait });
           }
+          //  Check if this is a Ping timeout. If it is and there are CASes on
+          //  the list of CASes pending reply, treat this timeout as Process
+          //  Timeout
+          if ( isAwaitingPingReply() && getCasPendingReplyListSize() > 0) {
+            String casReferenceId = getOldestCasIdFromOutstandingList();
+            errorContext.add(AsynchAEMessage.CasReference, casReferenceId);
+            //  Override the command to make sure this timeout is handled
+            //  by the ProcessCasErrorHandler.
+            errorContext.add(AsynchAEMessage.Command, AsynchAEMessage.Process);
+          }
         } else if (AsynchAEMessage.CollectionProcessComplete == aCommand) {
           if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
             UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, this.getClass().getName(),
@@ -574,7 +591,6 @@
           }
 
         }
-        errorContext.add(AsynchAEMessage.Command, aCommand);
         errorContext.add(AsynchAEMessage.Endpoint, getEndpoint());
         handleError(new MessageTimeoutException(), errorContext);
       }