org.apache.uima.internal.util
Class AnalysisEnginePool

java.lang.Object
  extended by org.apache.uima.internal.util.AnalysisEnginePool
Direct Known Subclasses:
TextAnalysisEnginePool

public class AnalysisEnginePool
extends java.lang.Object

A pool of Analysis Engines, which supports reconfiguration. This is not part of the stable UIMA API and may change in future releases.


Constructor Summary
AnalysisEnginePool(java.lang.String aName, int aNumInstances, ResourceSpecifier aResourceSpecifier)
          Creates a new AnalysisEnginePool.
AnalysisEnginePool(java.lang.String aName, int aNumInstances, ResourceSpecifier aResourceSpecifier, java.util.Map<java.lang.String,java.lang.Object> aResourceInitParams)
          Creates a new AnalysisEnginePool.
 
Method Summary
 void batchProcessComplete()
          Calls batchProcessComplete on all AEs in pool.
 void collectionProcessComplete()
          Calls collectionProcessComplete on all AEs in pool.
 void destroy()
          Destroys all AnalysisEngines in this pool.
 AnalysisEngine getAnalysisEngine()
          Checks out an AnalysisEngine from the pool.
 AnalysisEngine getAnalysisEngine(long aTimeout)
          Checks out an AnalysisEngine from the pool.
 AnalysisEngineMetaData getMetaData()
          Gets metadata for AnalysisEngines in this pool.
protected  java.lang.Class<AnalysisEngine> getResourceClass()
          Gets the class of Resource contained in this pool - by default this is AnalysisEngine, but subclasses may override.
 int getSize()
          Returns the size of this pool - the total number of AnalysisEngine instances it would contain if no instances were checked out.
 void reconfigure()
           
 void releaseAnalysisEngine(AnalysisEngine aAE)
          Checks in an AnalysisEngine to the pool.
 void setLogger(Logger aLogger)
          Sets logger for all AnalysisEngines in pool.
 void setResultSpecification(ResultSpecification aResultSpec)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnalysisEnginePool

public AnalysisEnginePool(java.lang.String aName,
                          int aNumInstances,
                          ResourceSpecifier aResourceSpecifier)
                   throws ResourceInitializationException
Creates a new AnalysisEnginePool.

Parameters:
aName - the pool name
aNumInstances - the number of Resource instances in the pool
aResourceSpecifier - specifier that describes how to create the Resource instances for the pool
Throws:
ResourceInitializationException - if the Resource instances could not be created

AnalysisEnginePool

public AnalysisEnginePool(java.lang.String aName,
                          int aNumInstances,
                          ResourceSpecifier aResourceSpecifier,
                          java.util.Map<java.lang.String,java.lang.Object> aResourceInitParams)
                   throws ResourceInitializationException
Creates a new AnalysisEnginePool.

Parameters:
aName - the pool name
aNumInstances - the number of Resource instances in the pool
aResourceSpecifier - specifier that describes how to create the Resource instances for the pool
aResourceInitParams - additional parameters to be passed to Resource.initialize(ResourceSpecifier,Map) methods. May be null if there are no parameters.
Throws:
ResourceInitializationException - if the Resource instances could not be created
Method Detail

getAnalysisEngine

public AnalysisEngine getAnalysisEngine()
Checks out an AnalysisEngine from the pool.

Returns:
an AnalysisEngine for use by the client. Returns null if none are available (in which case the client may wait on this object in order to be notified when an instance becomes available).

releaseAnalysisEngine

public void releaseAnalysisEngine(AnalysisEngine aAE)
Checks in an AnalysisEngine to the pool. Also notifies other Threads that may be waiting for a connection.

Parameters:
aResource - the resource to release

getAnalysisEngine

public AnalysisEngine getAnalysisEngine(long aTimeout)
Checks out an AnalysisEngine from the pool. If none is currently available, wait for the specified amount of time for one to be checked in.

Parameters:
aTimeout - the time to wait in milliseconds. A value of <=0 will wait forever.
Returns:
an AnalysisEngine for use by the client. Returns null if none are available (in which case the client may wait on this object in order to be notified when an instance becomes available).

destroy

public void destroy()
Destroys all AnalysisEngines in this pool.


getMetaData

public AnalysisEngineMetaData getMetaData()
Gets metadata for AnalysisEngines in this pool.


setResultSpecification

public void setResultSpecification(ResultSpecification aResultSpec)
See Also:
This version only called for setResultSpecification called from an appl on the MultiprocessingAnalysisEngine directly. process(cas, result-spec) calls setResultSpecification on the individual analysis engine from the pool.

reconfigure

public void reconfigure()
                 throws ResourceConfigurationException
Throws:
ResourceConfigurationException
See Also:
org.apache.uima.analysis_engine.MultithreadableAnalysisEngine#reconfigure()

batchProcessComplete

public void batchProcessComplete()
                          throws AnalysisEngineProcessException
Calls batchProcessComplete on all AEs in pool.

Throws:
AnalysisEngineProcessException

collectionProcessComplete

public void collectionProcessComplete()
                               throws AnalysisEngineProcessException
Calls collectionProcessComplete on all AEs in pool.

Throws:
AnalysisEngineProcessException

getSize

public int getSize()
Returns the size of this pool - the total number of AnalysisEngine instances it would contain if no instances were checked out.

Returns:
the pool size

setLogger

public void setLogger(Logger aLogger)
Sets logger for all AnalysisEngines in pool.


getResourceClass

protected java.lang.Class<AnalysisEngine> getResourceClass()
Gets the class of Resource contained in this pool - by default this is AnalysisEngine, but subclasses may override.

Returns:
class of Resource contained in this pool


Copyright © 2010 The Apache Software Foundation. All Rights Reserved.