Package org.apache.uima.internal.util
Class AnalysisEnginePool
java.lang.Object
org.apache.uima.internal.util.AnalysisEnginePool
- Direct Known Subclasses:
TextAnalysisEnginePool
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
ConstructorDescriptionAnalysisEnginePool
(String aName, int aNumInstances, ResourceSpecifier aResourceSpecifier) Creates a new AnalysisEnginePool.AnalysisEnginePool
(String aName, int aNumInstances, ResourceSpecifier aResourceSpecifier, Map<String, Object> aResourceInitParams) Creates a new AnalysisEnginePool. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Calls batchProcessComplete on all AEs in pool.void
Calls collectionProcessComplete on all AEs in pool.void
destroy()
Destroys all AnalysisEngines in this pool.Checks out an AnalysisEngine from the pool.getAnalysisEngine
(long aTimeout) Checks out an AnalysisEngine from the pool.Gets metadata for AnalysisEngines in this pool.protected Class
<AnalysisEngine> Gets the class of Resource contained in this pool - by default this isAnalysisEngine
, 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
void
Checks in an AnalysisEngine to the pool.void
Sets logger for all AnalysisEngines in pool.void
setResultSpecification
(ResultSpecification aResultSpec)
-
Constructor Details
-
AnalysisEnginePool
public AnalysisEnginePool(String aName, int aNumInstances, ResourceSpecifier aResourceSpecifier) throws ResourceInitializationException Creates 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(String aName, int aNumInstances, ResourceSpecifier aResourceSpecifier, Map<String, 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 Details
-
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
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
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
Gets metadata for AnalysisEngines in this pool.- Returns:
- -
-
setResultSpecification
- Parameters:
aResultSpec
- -- See Also:
-
reconfigure
- Throws:
ResourceConfigurationException
- -- See Also:
-
batchProcessComplete
Calls batchProcessComplete on all AEs in pool.- Throws:
AnalysisEngineProcessException
- -
-
collectionProcessComplete
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
Sets logger for all AnalysisEngines in pool.- Parameters:
aLogger
- -
-
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
-