Class AbstractProcessingUnitRunnable
- java.lang.Object
-
- com.github.toolarium.processing.unit.runtime.runnable.impl.AbstractProcessingUnitRunnable
-
- All Implemented Interfaces:
IProcessingUnitRunnable
- Direct Known Subclasses:
ProcessingUnitRunnable
public abstract class AbstractProcessingUnitRunnable extends java.lang.Object implements IProcessingUnitRunnable
AbstractIProcessingUnitRunnableimplementation.
-
-
Constructor Summary
Constructors Constructor Description AbstractProcessingUnitRunnable(byte[] suspendedState, IProcessingUnitRunnableListener processingUnitRunnableListener)ConstructorAbstractProcessingUnitRunnable(java.lang.String id, java.lang.String name, java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList, IProcessingUnitContext processingUnitContext)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanafterProcessUnit(boolean continueProcessing)Before process unit method callprotected ProcessingUnitProxycreateProcessingUnitProxy()Create processing unit proxyIEmptyProcessingUnitHandlergetEmptyProcessingUnitHandler()Get the empty processing unit handlerjava.lang.StringgetId()Get the runnable idjava.lang.LonggetMaxNumberOfProcessingUnitCallsPerSecond()Get the max calls per second to throttle the processing unitjava.lang.StringgetName()Get the runnable name or nulljava.util.List<Parameter>getParameterList()Get the processing parameter list.ProcessingActionStatusgetProcessingActionStatus()Get the processing action statusProcessingRuntimeStatusgetProcessingRuntimeStatus()Get the processing runtime statusprotected java.lang.Class<? extends IProcessingUnit>getProcessingUnitClass()Get the processing classprotected IProcessingUnitContextgetProcessingUnitContext()Get the processing unit contextIProcessingUnitProgressgetProcessingUnitProgress()Get the processing unit progressprotected ProcessingUnitProxygetProcessingUnitProxy()Get the processing unit proxyjava.util.List<java.lang.String>getStatusMessageList()Get the status message listprotected com.github.toolarium.common.formatter.TimeDifferenceFormattergetTimeDifferenceFormatter()Get the time difference formatterIProcessingUnitRuntimeTimeMeasurementgetTimeMeasurement()Get the time measurementprotected voidnotifyProcessingUnitProgress(com.github.toolarium.common.bandwidth.IBandwidthThrottling bandwidthThrottling)Notify processing unit action statusprotected voidnotifyProcessingUnitState(ProcessingActionStatus previousProcessingActionStatus, ProcessingActionStatus processingActionStatus)Notify processing unit action statusvoidreleaseResource()Release resources will be called to release all internal referenced resources after a processing success, warn or error.voidsetEmptyProcessingUnitHandler(IEmptyProcessingUnitHandler emptyProcessingUnitHandler)Set the empty processing unit handlervoidsetMaxNumberOfProcessingUnitCallsPerSecond(java.lang.Long maxNumberOfProcessingUnitCallsPerSecond)Defines the max calls per second to throttle the processing unitprotected voidsetProcessingActionStatus(ProcessingActionStatus processingActionStatus)Sets the processing action statusprotected voidsetProcessingUnitProxy(ProcessingUnitProxy processingUnitProxy)Set the processing unit proxyprotected voidsetProcessingUnitRunnableListener(IProcessingUnitRunnableListener processingUnitRunnableListener)Set the processing unit runnable listener
-
-
-
Constructor Detail
-
AbstractProcessingUnitRunnable
public AbstractProcessingUnitRunnable(java.lang.String id, java.lang.String name, java.lang.Class<? extends IProcessingUnit> processingUnitClass, java.util.List<Parameter> parameterList, IProcessingUnitContext processingUnitContext)Constructor- Parameters:
id- the unique id of this processingname- the name of this processing unit runnableprocessingUnitClass- the processing unit classparameterList- the parameter listprocessingUnitContext- the processing context.- Throws:
ValidationException- This will be throw in case the consistency check failures.ProcessingException- Throws this exception in case of initialization failures.
-
AbstractProcessingUnitRunnable
public AbstractProcessingUnitRunnable(byte[] suspendedState, IProcessingUnitRunnableListener processingUnitRunnableListener)Constructor- Parameters:
suspendedState- the suspended stateprocessingUnitRunnableListener- the processing unit runnable listener- Throws:
ValidationException- This will be throw in case the consistency check failures.ProcessingException- Throws this exception in case of initialization failures.
-
-
Method Detail
-
getId
public java.lang.String getId()
Description copied from interface:IProcessingUnitRunnableGet the runnable id- Specified by:
getIdin interfaceIProcessingUnitRunnable- Returns:
- the runnable id
- See Also:
IProcessingUnitRunnable.getId()
-
getName
public java.lang.String getName()
Description copied from interface:IProcessingUnitRunnableGet the runnable name or null- Specified by:
getNamein interfaceIProcessingUnitRunnable- Returns:
- the name or null
- See Also:
IProcessingUnitRunnable.getName()
-
getProcessingActionStatus
public ProcessingActionStatus getProcessingActionStatus()
Description copied from interface:IProcessingUnitRunnableGet the processing action status- Specified by:
getProcessingActionStatusin interfaceIProcessingUnitRunnable- Returns:
- the processing action status
- See Also:
IProcessingUnitRunnable.getProcessingActionStatus()
-
releaseResource
public void releaseResource() throws ProcessingExceptionDescription copied from interface:IProcessingUnitRunnableRelease resources will be called to release all internal referenced resources after a processing success, warn or error.- Specified by:
releaseResourcein interfaceIProcessingUnitRunnable- Throws:
ProcessingException- Throws this exception in case of releasing failure.- See Also:
IProcessingUnitRunnable.releaseResource()
-
setProcessingActionStatus
protected void setProcessingActionStatus(ProcessingActionStatus processingActionStatus)
Sets the processing action status- Parameters:
processingActionStatus- the processing action status
-
getProcessingUnitProgress
public IProcessingUnitProgress getProcessingUnitProgress()
Description copied from interface:IProcessingUnitRunnableGet the processing unit progress- Specified by:
getProcessingUnitProgressin interfaceIProcessingUnitRunnable- Returns:
- the process unit progress
- See Also:
IProcessingUnitRunnable.getProcessingUnitProgress()
-
getProcessingRuntimeStatus
public ProcessingRuntimeStatus getProcessingRuntimeStatus()
Description copied from interface:IProcessingUnitRunnableGet the processing runtime status- Specified by:
getProcessingRuntimeStatusin interfaceIProcessingUnitRunnable- Returns:
- the processing runtime status
- See Also:
IProcessingUnitRunnable.getProcessingRuntimeStatus()
-
getStatusMessageList
public java.util.List<java.lang.String> getStatusMessageList()
Description copied from interface:IProcessingUnitRunnableGet the status message list- Specified by:
getStatusMessageListin interfaceIProcessingUnitRunnable- Returns:
- the status message list
- See Also:
IProcessingUnitRunnable.getStatusMessageList()
-
getTimeMeasurement
public IProcessingUnitRuntimeTimeMeasurement getTimeMeasurement()
Description copied from interface:IProcessingUnitRunnableGet the time measurement- Specified by:
getTimeMeasurementin interfaceIProcessingUnitRunnable- Returns:
- the time measurement
- See Also:
IProcessingUnitRunnable.getTimeMeasurement()
-
getParameterList
public java.util.List<Parameter> getParameterList()
Description copied from interface:IProcessingUnitRunnableGet the processing parameter list.- Specified by:
getParameterListin interfaceIProcessingUnitRunnable- Returns:
- the processing parameter list
- See Also:
IProcessingUnitRunnable.getParameterList()
-
getEmptyProcessingUnitHandler
public IEmptyProcessingUnitHandler getEmptyProcessingUnitHandler()
Get the empty processing unit handler- Returns:
- the empty processing unit handler
-
setEmptyProcessingUnitHandler
public void setEmptyProcessingUnitHandler(IEmptyProcessingUnitHandler emptyProcessingUnitHandler)
Set the empty processing unit handler- Parameters:
emptyProcessingUnitHandler- the empty processing unit handler
-
setMaxNumberOfProcessingUnitCallsPerSecond
public void setMaxNumberOfProcessingUnitCallsPerSecond(java.lang.Long maxNumberOfProcessingUnitCallsPerSecond)
Defines the max calls per second to throttle the processing unit- Parameters:
maxNumberOfProcessingUnitCallsPerSecond- the max number of processing units per second
-
getMaxNumberOfProcessingUnitCallsPerSecond
public java.lang.Long getMaxNumberOfProcessingUnitCallsPerSecond()
Get the max calls per second to throttle the processing unit- Returns:
- the max number of processing units per second
-
getProcessingUnitContext
protected IProcessingUnitContext getProcessingUnitContext()
Get the processing unit context- Returns:
- the processing unit context
-
createProcessingUnitProxy
protected ProcessingUnitProxy createProcessingUnitProxy()
Create processing unit proxy- Returns:
- the processing unit proxy
-
getProcessingUnitProxy
protected ProcessingUnitProxy getProcessingUnitProxy()
Get the processing unit proxy- Returns:
- the processing unit proxy
-
setProcessingUnitProxy
protected void setProcessingUnitProxy(ProcessingUnitProxy processingUnitProxy)
Set the processing unit proxy- Parameters:
processingUnitProxy- the processing unit proxy
-
afterProcessUnit
protected boolean afterProcessUnit(boolean continueProcessing)
Before process unit method call- Parameters:
continueProcessing- the continue processing- Returns:
- the continue processing
-
setProcessingUnitRunnableListener
protected void setProcessingUnitRunnableListener(IProcessingUnitRunnableListener processingUnitRunnableListener)
Set the processing unit runnable listener- Parameters:
processingUnitRunnableListener- the processing unit runnable listener
-
notifyProcessingUnitProgress
protected void notifyProcessingUnitProgress(com.github.toolarium.common.bandwidth.IBandwidthThrottling bandwidthThrottling)
Notify processing unit action status- Parameters:
bandwidthThrottling- the bandwidth throttling
-
notifyProcessingUnitState
protected void notifyProcessingUnitState(ProcessingActionStatus previousProcessingActionStatus, ProcessingActionStatus processingActionStatus)
Notify processing unit action status- Parameters:
previousProcessingActionStatus- the previous processing action statusprocessingActionStatus- the processing action status
-
getTimeDifferenceFormatter
protected com.github.toolarium.common.formatter.TimeDifferenceFormatter getTimeDifferenceFormatter()
Get the time difference formatter- Returns:
- the time difference formatter
-
getProcessingUnitClass
protected java.lang.Class<? extends IProcessingUnit> getProcessingUnitClass()
Get the processing class- Returns:
- the processing class
-
-