Package org.apache.uima.internal.util
Class AnalysisEnginePool
- java.lang.Object
-
- org.apache.uima.internal.util.AnalysisEnginePool
-
- Direct Known Subclasses:
TextAnalysisEnginePool
public class AnalysisEnginePool extends java.lang.ObjectA pool of Analysis Engines, which supports reconfiguration. This is not part of the stable UIMA API and may change in future releases.
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbatchProcessComplete()Calls batchProcessComplete on all AEs in pool.voidcollectionProcessComplete()Calls collectionProcessComplete on all AEs in pool.voiddestroy()Destroys all AnalysisEngines in this pool.AnalysisEnginegetAnalysisEngine()Checks out an AnalysisEngine from the pool.AnalysisEnginegetAnalysisEngine(long aTimeout)Checks out an AnalysisEngine from the pool.AnalysisEngineMetaDatagetMetaData()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 isAnalysisEngine, but subclasses may override.intgetSize()Returns the size of this pool - the total number of AnalysisEngine instances it would contain if no instances were checked out.voidreconfigure()voidreleaseAnalysisEngine(AnalysisEngine aAE)Checks in an AnalysisEngine to the pool.voidsetLogger(Logger aLogger)Sets logger for all AnalysisEngines in pool.voidsetResultSpecification(ResultSpecification aResultSpec)
-
-
-
Constructor Detail
-
AnalysisEnginePool
public AnalysisEnginePool(java.lang.String aName, int aNumInstances, ResourceSpecifier aResourceSpecifier) throws ResourceInitializationExceptionCreates a new AnalysisEnginePool.- Parameters:
aName- the pool nameaNumInstances- the number of Resource instances in the poolaResourceSpecifier- 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 ResourceInitializationExceptionCreates a new AnalysisEnginePool.- Parameters:
aName- the pool nameaNumInstances- the number of Resource instances in the poolaResourceSpecifier- specifier that describes how to create the Resource instances for the poolaResourceInitParams- additional parameters to be passed toResource.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
nullif 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:
aAE- 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
nullif 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.- Returns:
- -
-
setResultSpecification
public void setResultSpecification(ResultSpecification aResultSpec)
-
reconfigure
public void reconfigure() throws ResourceConfigurationException- Throws:
ResourceConfigurationException- -- See Also:
ConfigurableResource.reconfigure()
-
batchProcessComplete
public void batchProcessComplete() throws AnalysisEngineProcessExceptionCalls batchProcessComplete on all AEs in pool.- Throws:
AnalysisEngineProcessException- -
-
collectionProcessComplete
public void collectionProcessComplete() throws AnalysisEngineProcessExceptionCalls 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.- Parameters:
aLogger- -
-
getResourceClass
protected java.lang.Class<AnalysisEngine> getResourceClass()
Gets the class of Resource contained in this pool - by default this isAnalysisEngine, but subclasses may override.- Returns:
- class of Resource contained in this pool
-
-