Interface IProcessingUnit
-
- All Known Subinterfaces:
IParallelProcessingUnit
- All Known Implementing Classes:
AbstractProcessingUnitImpl,AbstractProcessingUnitPersistenceImpl,ParallelProcessingUnit,TestProcessingUnit
public interface IProcessingUnitDefines the processing unit interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longestimateNumberOfUnitsToProcess()Estimate the number of units to process.java.util.List<ParameterDefinition>getParameterDefinition()Gets the parameter definition list of the processing.voidinitialize(java.util.List<Parameter> parameterList, IProcessingUnitContext processingUnitContext)Initializes the processing unit.voidonAborting()This method is called in case of an abort (status aborting) before the resources are released.voidonEnding()This method is called on ending after a successful end (status ending) before the resources are released.IProcessingUnitStatusprocessUnit()Process unit: This method will be called until theIProcessingUnitStatus.hasNext()returns false.voidreleaseResource()Release resources will be called to release all internal referenced resources after a processing success, error or by asuspendProcessing(see method below).voidresumeProcessing(IProcessingUnitProgress processingUnitProgress, IProcessingUnitPersistence processingPersistence)After suspending a processing unit can be resumed.IProcessingUnitPersistencesuspendProcessing()Suspends the processing: The processing is able to persist its state with the help of theIProcessingUnitPersistenceobject.voidvalidateParameterList(java.util.List<Parameter> parameterList)Validate the parameter list consistency of this class with the parameters.
-
-
-
Method Detail
-
getParameterDefinition
java.util.List<ParameterDefinition> getParameterDefinition()
Gets the parameter definition list of the processing.- Returns:
- the parameter definition list or null in case of no parameters
-
validateParameterList
void validateParameterList(java.util.List<Parameter> parameterList) throws ValidationException
Validate the parameter list consistency of this class with the parameters. Typical it will be called during the initialization. It can be used to verify if the parameter of this processing are well defined.- Parameters:
parameterList- the parameter list.- Throws:
ValidationException- This will be throw in case the consistency check failures.
-
initialize
void initialize(java.util.List<Parameter> parameterList, IProcessingUnitContext processingUnitContext) throws ValidationException, ProcessingException
Initializes the processing unit. This will called as first to initialize the processing unit. It is also used when processing is interrupted and resumed.- Parameters:
parameterList- the parameter list to run the processing.processingUnitContext- the processing context.- Throws:
ValidationException- This will be throw in case the consistency check failures.ProcessingException- Throws this exception in case of initialization failures.
-
estimateNumberOfUnitsToProcess
long estimateNumberOfUnitsToProcess() throws ProcessingExceptionEstimate the number of units to process. It will be called once afterinitialize(List, IProcessingUnitContext). It set the the number of units to process in the objectIProcessingUnitProgress. In case there are more elements to process than estimated, the progress will adapted. In case of aresumeProcessing(IProcessingUnitProgress, IProcessingUnitPersistence)it will not be called again.- Returns:
- returns the number of units to process
- Throws:
ProcessingException- Throws this exception in case of initialization failures.
-
processUnit
IProcessingUnitStatus processUnit() throws ProcessingException
Process unit: This method will be called until theIProcessingUnitStatus.hasNext()returns false. Important: this method have to process the sequential or in a small block size.- Returns:
- the process unit status
- Throws:
ProcessingException- In case of any failures occurs.
-
onEnding
void onEnding()
This method is called on ending after a successful end (status ending) before the resources are released.
-
onAborting
void onAborting()
This method is called in case of an abort (status aborting) before the resources are released.
-
releaseResource
void releaseResource() throws ProcessingExceptionRelease resources will be called to release all internal referenced resources after a processing success, error or by asuspendProcessing(see method below). It will be called afteronEnding()oronAborting().- Throws:
ProcessingException- Throws this exception in case of releasing failure.
-
suspendProcessing
IProcessingUnitPersistence suspendProcessing() throws ProcessingException
Suspends the processing: The processing is able to persist its state with the help of theIProcessingUnitPersistenceobject. On a resume this instance of theIProcessingUnitPersistencewill be returned (see method below). TheIProcessingUnitPersistencedon't need to contain any parameters or additional statuses. They are covered by the framework.- Returns:
- the processing persistence which contains all information to resume processing later (see resumeProcessing).
- Throws:
ProcessingException- Throws this exception in case of while suspend the processing any failures occurs.
-
resumeProcessing
void resumeProcessing(IProcessingUnitProgress processingUnitProgress, IProcessingUnitPersistence processingPersistence) throws ProcessingException
After suspending a processing unit can be resumed. The parameter list of the initialization is passed as well theIProcessingUnitPersistencewhich was returned by the suspendProcessing method. The main purpose of this call is to set the processing persistence.- Parameters:
processingUnitProgress- the processing unit progress of the processing unit before suspending.processingPersistence- the processing persistence to resume after suspending.- Throws:
ProcessingException- Throws this exception in case of while resume the processing any failures occurs.
-
-