org.apache.uima.aae
Class UimaAsThreadFactory

java.lang.Object
  extended by org.apache.uima.aae.UimaAsThreadFactory
All Implemented Interfaces:
java.util.concurrent.ThreadFactory

public class UimaAsThreadFactory
extends java.lang.Object
implements java.util.concurrent.ThreadFactory

Custom ThreadFactory for use in the TaskExecutor. The TaskExecutor is plugged in by Spring from spring xml file generated by dd2spring. The TaskExecutor is only defined for PrimitiveControllers and its main purpose is to provide thread pooling and management. Each new thread produced by this ThreadFactory is used to initialize a dedicated AE instance in the PrimitiveController.


Field Summary
static java.util.concurrent.atomic.AtomicInteger poolIdGenerator
           
 
Constructor Summary
UimaAsThreadFactory(java.lang.ThreadGroup tGroup)
           
UimaAsThreadFactory(java.lang.ThreadGroup tGroup, PrimitiveAnalysisEngineController aController)
           
 
Method Summary
 java.lang.Thread newThread(java.lang.Runnable r)
          Creates a new thread, initializes instance of AE via a call on a given PrimitiveController.
 void setDaemon(boolean daemon)
           
 void setThreadGroup(java.lang.ThreadGroup tGroup)
           
 void setThreadNamePrefix(java.lang.String prefix)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

poolIdGenerator

public static java.util.concurrent.atomic.AtomicInteger poolIdGenerator
Constructor Detail

UimaAsThreadFactory

public UimaAsThreadFactory(java.lang.ThreadGroup tGroup)

UimaAsThreadFactory

public UimaAsThreadFactory(java.lang.ThreadGroup tGroup,
                           PrimitiveAnalysisEngineController aController)
Parameters:
tGroup -
aController -
Method Detail

setThreadNamePrefix

public void setThreadNamePrefix(java.lang.String prefix)

setThreadGroup

public void setThreadGroup(java.lang.ThreadGroup tGroup)

setDaemon

public void setDaemon(boolean daemon)

stop

public void stop()

newThread

public java.lang.Thread newThread(java.lang.Runnable r)
Creates a new thread, initializes instance of AE via a call on a given PrimitiveController. Once the thread finishes initializing AE instance in the controller, it calls run() on a given Runnable. This Runnable is a Worker instance managed by the TaskExecutor. When the thread calls run() on the Runnable it blocks until the Worker releases it.

Specified by:
newThread in interface java.util.concurrent.ThreadFactory


Copyright © 2011. All Rights Reserved.