Author: cwiklik
Date: Fri Jan 20 16:16:24 2012
New Revision: 1233982

URL: http://svn.apache.org/viewvc?rev=1233982&view=rev
Log:
UIMA-2354 associate a semaphore with a CAS entry. This semaphore is shared with 
a receiving thread and used to unblock that thread when CAS processing is done

Modified:
    
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java

Modified: 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
URL: 
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java?rev=1233982&r1=1233981&r2=1233982&view=diff
==============================================================================
--- 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
 (original)
+++ 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
 Fri Jan 20 16:16:24 2012
@@ -27,6 +27,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.Stack;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Semaphore;
 
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.aae.controller.ControllerLifecycle;
@@ -556,6 +557,23 @@ public class InProcessCache implements I
     // list. The delegates in this list will be called sequentially when
     // all delegates in parallel step respond.
     private List delayedSingleStepList = null;
+               //      shared semaphore that blocks UIMA AS aggregate receiving
+               //  thread after a CAS is handed off to the first delegate.
+               //  This stops the aggregate's receiving thread from taking
+               //  another CAS off the input queue while the current CAS is
+               //  still being processed. This semaphore is shared with a 
+               //  receiving thread which has a reference to the semaphore
+               //  via ThreadLocal var
+    private Semaphore threadCompletionSemaphore;
+    
+    
+    public Semaphore getThreadCompletionSemaphore() {
+      return threadCompletionSemaphore;
+    }
+
+    public void setThreadCompletionSemaphore(Semaphore 
threadCompletionSemaphore) {
+      this.threadCompletionSemaphore = threadCompletionSemaphore;
+    }
 
     protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext 
aMessageAccessor,
             OutOfTypeSystemData aotsd) {


Reply via email to