public class PoolingProcessingComponentManager extends Object implements IProcessingComponentManager
IProcessingComponentManager
that pools instances of processing components.Constructor and Description |
---|
PoolingProcessingComponentManager()
Creates a new
PoolingProcessingComponentManager using the default pool
implementation SoftUnboundedPool ). |
PoolingProcessingComponentManager(IParameterizedPool<IProcessingComponent,String> componentPool)
Creates a new
PoolingProcessingComponentManager with a custom pool
implementation. |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Called upon disposal of the controller.
|
void |
init(IControllerContext context,
Map<String,Object> attributes,
ProcessingComponentConfiguration... configurations)
Called upon initialization of the
Controller . |
IProcessingComponent |
prepare(Class<? extends IProcessingComponent> clazz,
String id,
Map<String,Object> inputAttributes,
Map<String,Object> outputAttributes)
Prepares a component for processing.
|
void |
recycle(IProcessingComponent component,
String id)
Called after processing completed.
|
public PoolingProcessingComponentManager()
PoolingProcessingComponentManager
using the default pool
implementation SoftUnboundedPool
).public PoolingProcessingComponentManager(IParameterizedPool<IProcessingComponent,String> componentPool)
PoolingProcessingComponentManager
with a custom pool
implementation.componentPool
- the pool to be used by this managerpublic void init(IControllerContext context, Map<String,Object> attributes, ProcessingComponentConfiguration... configurations)
IProcessingComponentManager
Controller
.init
in interface IProcessingComponentManager
context
- controller contextattributes
- global initialization attributes provided to the controllerconfigurations
- component configurations provided to the controllerpublic IProcessingComponent prepare(Class<? extends IProcessingComponent> clazz, String id, Map<String,Object> inputAttributes, Map<String,Object> outputAttributes)
IProcessingComponentManager
prepare
in interface IProcessingComponentManager
clazz
- class of the component to prepareid
- Identifier of the component to prepare. May be null
.inputAttributes
- input attributes for all components requested to perform
processing. Both Init
- and Processing
-time attributes
will be provided. Managers must not modify this map.outputAttributes
- storage for output attributespublic void recycle(IProcessingComponent component, String id)
IProcessingComponentManager
recycle
in interface IProcessingComponentManager
component
- Component instance returned from IProcessingComponentManager.prepare(java.lang.Class<? extends org.carrot2.core.IProcessingComponent>, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>)
.id
- The same identifier of the component as used in the call to
IProcessingComponentManager.prepare(java.lang.Class<? extends org.carrot2.core.IProcessingComponent>, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>)
. May be null
.public void dispose()
IProcessingComponentManager
dispose
in interface IProcessingComponentManager