org.carrot2.core
Class PoolingProcessingComponentManager

java.lang.Object
  extended by org.carrot2.core.PoolingProcessingComponentManager
All Implemented Interfaces:
IProcessingComponentManager

public class PoolingProcessingComponentManager
extends Object
implements IProcessingComponentManager

An IProcessingComponentManager that pools instances of processing components.


Constructor Summary
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.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoolingProcessingComponentManager

public PoolingProcessingComponentManager()
Creates a new PoolingProcessingComponentManager using the default pool implementation SoftUnboundedPool).


PoolingProcessingComponentManager

public PoolingProcessingComponentManager(IParameterizedPool<IProcessingComponent,String> componentPool)
Creates a new PoolingProcessingComponentManager with a custom pool implementation.

Parameters:
componentPool - the pool to be used by this manager
Method Detail

init

public void init(IControllerContext context,
                 Map<String,Object> attributes,
                 ProcessingComponentConfiguration... configurations)
Description copied from interface: IProcessingComponentManager
Called upon initialization of the Controller.

Specified by:
init in interface IProcessingComponentManager
Parameters:
context - controller context
attributes - global initialization attributes provided to the controller
configurations - component configurations provided to the controller

prepare

public IProcessingComponent prepare(Class<? extends IProcessingComponent> clazz,
                                    String id,
                                    Map<String,Object> inputAttributes,
                                    Map<String,Object> outputAttributes)
Description copied from interface: IProcessingComponentManager
Prepares a component for processing. Specific managers may simply instantiate a new component object, fetch a component from a pool or wrap a component prepared by a delegate manager etc.

Specified by:
prepare in interface IProcessingComponentManager
Parameters:
clazz - class of the component to prepare
id - 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 attributes

recycle

public void recycle(IProcessingComponent component,
                    String id)
Description copied from interface: IProcessingComponentManager
Called after processing completed. This method is called regardless of whether the processing completed successfully or with an error.

Specified by:
recycle in interface IProcessingComponentManager
Parameters:
component - Component instance returned from IProcessingComponentManager.prepare(java.lang.Class, java.lang.String, java.util.Map, java.util.Map).
id - The same identifier of the component as used in the call to IProcessingComponentManager.prepare(java.lang.Class, java.lang.String, java.util.Map, java.util.Map). May be null.

dispose

public void dispose()
Description copied from interface: IProcessingComponentManager
Called upon disposal of the controller.

Specified by:
dispose in interface IProcessingComponentManager


Copyright (c) Dawid Weiss, Stanislaw Osinski