org.apache.uima.aae
Class UimaBlockingExecutor

java.lang.Object
  extended by org.apache.uima.aae.UimaBlockingExecutor

public class UimaBlockingExecutor
extends java.lang.Object

A wrapper around ThreadPoolExecutor that blocks a thread if number of executing threads exceeds provided maximum number of permits. The implementation uses a semaphore that is initialized with a max number of permits. Each thread grabs a permit and executes. If all permits are exhausted, a thread blocks on a semaphore until a permit is available.


Constructor Summary
UimaBlockingExecutor(java.util.concurrent.ThreadPoolExecutor executor, int permits)
           
UimaBlockingExecutor(java.util.concurrent.ThreadPoolExecutor executor, int permits, java.lang.String destination)
           
 
Method Summary
 boolean isReady()
           
 void stop()
           
 void submitTask(java.lang.Runnable task)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UimaBlockingExecutor

public UimaBlockingExecutor(java.util.concurrent.ThreadPoolExecutor executor,
                            int permits)

UimaBlockingExecutor

public UimaBlockingExecutor(java.util.concurrent.ThreadPoolExecutor executor,
                            int permits,
                            java.lang.String destination)
Method Detail

isReady

public boolean isReady()

stop

public void stop()

submitTask

public void submitTask(java.lang.Runnable task)
                throws java.lang.InterruptedException,
                       java.util.concurrent.RejectedExecutionException
Throws:
java.lang.InterruptedException
java.util.concurrent.RejectedExecutionException


Copyright © 2011. All Rights Reserved.