Package pro.taskana.common.internal.jobs
Class AbstractTaskanaJob
- java.lang.Object
-
- pro.taskana.common.internal.jobs.AbstractTaskanaJob
-
- All Implemented Interfaces:
TaskanaJob
- Direct Known Subclasses:
ClassificationChangedJob,TaskCleanupJob,TaskRefreshJob,TaskUpdatePriorityJob,WorkbasketCleanupJob
public abstract class AbstractTaskanaJob extends Object implements TaskanaJob
Abstract base for all background jobs of TASKANA.
-
-
Field Summary
Fields Modifier and Type Field Description protected InstantfirstRunprotected DurationrunEveryprotected ScheduledJobscheduledJobprotected TaskanaEngineImpltaskanaEngineImplprotected TaskanaTransactionProvidertxProvider
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTaskanaJob(TaskanaEngine taskanaEngine, TaskanaTransactionProvider txProvider, ScheduledJob job, boolean async)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static TaskanaJobcreateFromScheduledJob(TaskanaEngine engine, TaskanaTransactionProvider txProvider, ScheduledJob job)protected abstract voidexecute()InstantgetFirstRun()protected InstantgetNextDueForJob()DurationgetRunEvery()protected abstract StringgetType()static voidinitializeSchedule(TaskanaEngine taskanaEngine, Class<?> jobClass)Initializes the TaskCleanupJob schedule.booleanisAsync()voidrun()Execute the TaskanaJob.protected voidscheduleNextJob()
-
-
-
Field Detail
-
taskanaEngineImpl
protected final TaskanaEngineImpl taskanaEngineImpl
-
txProvider
protected final TaskanaTransactionProvider txProvider
-
scheduledJob
protected final ScheduledJob scheduledJob
-
firstRun
protected Instant firstRun
-
runEvery
protected Duration runEvery
-
-
Constructor Detail
-
AbstractTaskanaJob
protected AbstractTaskanaJob(TaskanaEngine taskanaEngine, TaskanaTransactionProvider txProvider, ScheduledJob job, boolean async)
-
-
Method Detail
-
createFromScheduledJob
public static TaskanaJob createFromScheduledJob(TaskanaEngine engine, TaskanaTransactionProvider txProvider, ScheduledJob job) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException
-
run
public final void run() throws TaskanaExceptionDescription copied from interface:TaskanaJobExecute the TaskanaJob.- Specified by:
runin interfaceTaskanaJob- Throws:
TaskanaException- if any exception occurs during the execution.
-
initializeSchedule
public static void initializeSchedule(TaskanaEngine taskanaEngine, Class<?> jobClass)
Initializes the TaskCleanupJob schedule.
All scheduled cleanup jobs are cancelled/deleted and a new one is scheduled.- Parameters:
taskanaEngine- the TASKANA engine.jobClass- the class of the job which should be scheduled- Throws:
SystemException- if the jobClass could not be scheduled.
-
isAsync
public boolean isAsync()
-
getFirstRun
public Instant getFirstRun()
-
getRunEvery
public Duration getRunEvery()
-
getType
protected abstract String getType()
-
execute
protected abstract void execute() throws TaskanaException- Throws:
TaskanaException
-
getNextDueForJob
protected Instant getNextDueForJob()
-
scheduleNextJob
protected void scheduleNextJob()
-
-