public abstract class ProcessingComponentBase extends Object implements IProcessingComponent
IProcessingComponent
interface that
provides empty implementations of all life cycle methods.Constructor and Description |
---|
ProcessingComponentBase() |
Modifier and Type | Method and Description |
---|---|
void |
afterProcessing()
Invoked after the processing has finished, no matter whether an exception has been
thrown or not.
|
void |
beforeProcessing()
Invoked after the attributes marked with
Processing and Input
annotations have been bound, but before a call to IProcessingComponent.process() . |
void |
dispose()
Invoked before this processing component is about to be destroyed.
|
protected IControllerContext |
getContext()
Return the
IControllerContext passed in init(IControllerContext) . |
protected ExecutorService |
getSharedExecutor(int maxConcurrentThreads,
Class<?> clazz) |
void |
init(IControllerContext context)
Invoked after component's attributes marked with
Init and Input
annotations have been bound, but before calls to any other methods of this
component. |
void |
process()
Performs the processing required to fulfill the request.
|
public void init(IControllerContext context)
IProcessingComponent
Init
and Input
annotations have been bound, but before calls to any other methods of this
component. After a call to this method completes without an exception, attributes
marked with Init
Output
will be collected. In this method,
components should perform initializations based on the initialization-time
attributes. This method is called once in the life time of a processing
component instance.init
in interface IProcessingComponent
context
- An instance of IControllerContext
of the controller to which this
component instance will be bound.public void beforeProcessing() throws ProcessingException
IProcessingComponent
Processing
and Input
annotations have been bound, but before a call to IProcessingComponent.process()
. In this
method, the processing component should perform any initializations based on the
runtime attributes. This method is called once per request.beforeProcessing
in interface IProcessingComponent
ProcessingException
- when processing cannot start, e.g. because some
attributes were not bound. If thrown, the IProcessingComponent.process()
method
will not be called. Instead, IProcessingComponent.afterProcessing()
will be called
immediately to allow clean-up actions, and the component will be ready
to accept further requests or to be disposed of. Finally, the exception
will be rethrown from the controller method that caused the component
to perform processing.public void process() throws ProcessingException
IProcessingComponent
process
in interface IProcessingComponent
ProcessingException
- when processing failed. If thrown, the
IProcessingComponent.afterProcessing()
method will be called and the component will
be ready to accept further requests or to be disposed of. Finally, the
exception will be rethrown from the controller method that caused the
component to perform processing.public void afterProcessing()
IProcessingComponent
Processing
and Output
annotations will be collected. In this
method, the processing component should dispose of any resources it has allocated
to fulfill the request. No matter whether a call to this method completes
successfully or with an exception, the component will be ready to accept further
requests or to be disposed of. This method is called once per request.afterProcessing
in interface IProcessingComponent
protected final IControllerContext getContext()
IControllerContext
passed in init(IControllerContext)
.protected ExecutorService getSharedExecutor(int maxConcurrentThreads, Class<?> clazz)
public void dispose()
IProcessingComponent
dispose
in interface IProcessingComponent