Class EmptyProcessingUnitHandler
- java.lang.Object
-
- com.github.toolarium.processing.unit.runtime.runnable.EmptyProcessingUnitHandler
-
- All Implemented Interfaces:
IEmptyProcessingUnitHandler,java.io.Serializable
public class EmptyProcessingUnitHandler extends java.lang.Object implements IEmptyProcessingUnitHandler
Implements theIEmptyProcessingUnitHandler.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EmptyProcessingUnitHandler()Constructor for EmptyProcessingUnitHandler
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetDuration()Get the duration of this handler.java.lang.LonggetMaxNumberOfEmptyProcessingUnits()Get the maximum number of empty processing units before it aborts.java.lang.LonggetSleepTimeAfterEmptyProcessingUnit()Get the sleep time of an empty processing unit run after there was no progress (no failed nor successful units).booleanhandleEmptyProcessing(java.lang.String id, java.lang.String name, java.lang.Class<? extends IProcessingUnit> processingUnitClass, long threadId, IProcessingUnitProgress processingUnitProgress)Handle empty processing of a procesing unitvoidreset(java.lang.String id, java.lang.String name, java.lang.Class<? extends IProcessingUnit> processingUnitClass, long threadId, IProcessingUnitProgress processingUnitProgress)Reset empty processing unit handler.voidsetMaxNumberOfEmptyProcessingUnits(java.lang.Long maxNumberOfEmptyProcessingUnits)Defines the max.voidsetSleepTimeAfterEmptyProcessingUnit(java.lang.Long emptyProceessingUnitSleepTime)Defines the sleep time of an empty processing unit after there was no progress (no failed nor successful units).
-
-
-
Method Detail
-
getMaxNumberOfEmptyProcessingUnits
public java.lang.Long getMaxNumberOfEmptyProcessingUnits()
Get the maximum number of empty processing units before it aborts. An empty processing unit mean that there was no progress: no failed nor successful units processed determined by theIProcessingUnitStatus. The maximum number indicates after how many empty runs the processing unit will abort.- Returns:
- the max. number of processing unit runs with no progress
-
setMaxNumberOfEmptyProcessingUnits
public void setMaxNumberOfEmptyProcessingUnits(java.lang.Long maxNumberOfEmptyProcessingUnits)
Defines the max. number of processing unit runs with no progress (no failed nor successful) before it aborts.- Parameters:
maxNumberOfEmptyProcessingUnits- the max number of processing unit runs with no progress before it aborts
-
getSleepTimeAfterEmptyProcessingUnit
public java.lang.Long getSleepTimeAfterEmptyProcessingUnit()
Get the sleep time of an empty processing unit run after there was no progress (no failed nor successful units).- Returns:
- the sleep time in milliseconds
-
setSleepTimeAfterEmptyProcessingUnit
public void setSleepTimeAfterEmptyProcessingUnit(java.lang.Long emptyProceessingUnitSleepTime)
Defines the sleep time of an empty processing unit after there was no progress (no failed nor successful units).- Parameters:
emptyProceessingUnitSleepTime- the sleep time in milliseconds
-
reset
public void reset(java.lang.String id, java.lang.String name, java.lang.Class<? extends IProcessingUnit> processingUnitClass, long threadId, IProcessingUnitProgress processingUnitProgress)Description copied from interface:IEmptyProcessingUnitHandlerReset empty processing unit handler. It will be called after a non-empty processing occured.- Specified by:
resetin interfaceIEmptyProcessingUnitHandler- Parameters:
id- the idname- the nameprocessingUnitClass- the processing unit classthreadId- the thread idprocessingUnitProgress- the processing unit progress- See Also:
IEmptyProcessingUnitHandler.reset(java.lang.String, java.lang.String, java.lang.Class, long, com.github.toolarium.processing.unit.IProcessingUnitProgress)
-
handleEmptyProcessing
public boolean handleEmptyProcessing(java.lang.String id, java.lang.String name, java.lang.Class<? extends IProcessingUnit> processingUnitClass, long threadId, IProcessingUnitProgress processingUnitProgress)Description copied from interface:IEmptyProcessingUnitHandlerHandle empty processing of a procesing unit- Specified by:
handleEmptyProcessingin interfaceIEmptyProcessingUnitHandler- Parameters:
id- the idname- the nameprocessingUnitClass- the processing unit classthreadId- the thread idprocessingUnitProgress- the processing unit progress- Returns:
- true to continue or false to abort processing
- See Also:
IEmptyProcessingUnitHandler.handleEmptyProcessing(java.lang.String, java.lang.String, java.lang.Class, long, com.github.toolarium.processing.unit.IProcessingUnitProgress)
-
getDuration
public long getDuration()
Description copied from interface:IEmptyProcessingUnitHandlerGet the duration of this handler. This is to calculate exact duration of a processing.- Specified by:
getDurationin interfaceIEmptyProcessingUnitHandler- Returns:
- the duration of this handler has taken
- See Also:
IEmptyProcessingUnitHandler.getDuration()
-
-