Package io.github.qsy7.queue.impl.worker
Class DefaultJobWorkerService
java.lang.Object
io.github.qsy7.queue.impl.worker.DefaultJobWorkerService
- All Implemented Interfaces:
JobWorkerService,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final JobBuilderprotected final booleanprotected final Set<RunningFuture> protected final ScheduledThreadPoolExecutorprotected booleanprotected final longprotected final TimeUnitprotected final io.github.qsy7.queue.api.model.Worker -
Constructor Summary
ConstructorsConstructorDescriptionDefaultJobWorkerService(boolean noOperation, long shutdownTimeout, TimeUnit shutdownTimeoutUnits, JobBuilder jobBuilder, io.github.qsy7.queue.api.model.Worker worker) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel(io.github.qsy7.queue.api.model.AbstractQueued queued) To be invoked by the queue service directly for cancelling jobs.voidcancel(io.github.qsy7.queue.api.model.JobExecution jobExecution) To be invoked by the queue service directly for cancelling a specific job execution.protected voidvoidclose()protected voiddoQueue(io.github.qsy7.queue.api.model.AbstractQueued queued) longio.github.qsy7.queue.api.model.Workerprotected voidhandleRemovalOfRunnable(Runnable runnable) booleanbooleanio.github.qsy7.queue.api.model.AbstractQueuedqueue(io.github.qsy7.queue.api.model.AbstractQueued queued) voidremove(RunningFuture runningFuture) To be invoked by the AbstractRunnable upon completion or failure.protected void
-
Field Details
-
noOperation
protected final boolean noOperation -
shutdownTimeout
protected final long shutdownTimeout -
shutdownTimeoutUnits
-
jobBuilder
-
worker
protected final io.github.qsy7.queue.api.model.Worker worker -
scheduledThreadPoolExecutor
-
shutdown
protected boolean shutdown -
runningFutures
-
-
Constructor Details
-
DefaultJobWorkerService
@Inject public DefaultJobWorkerService(boolean noOperation, long shutdownTimeout, TimeUnit shutdownTimeoutUnits, JobBuilder jobBuilder, io.github.qsy7.queue.api.model.Worker worker)
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
updateCancelledJobs
protected void updateCancelledJobs() -
handleRemovalOfRunnable
-
checkIfShutdown
protected void checkIfShutdown() -
queue
public io.github.qsy7.queue.api.model.AbstractQueued queue(io.github.qsy7.queue.api.model.AbstractQueued queued) - Specified by:
queuein interfaceJobWorkerService
-
doQueue
protected void doQueue(io.github.qsy7.queue.api.model.AbstractQueued queued) -
cancel
public void cancel(io.github.qsy7.queue.api.model.AbstractQueued queued) To be invoked by the queue service directly for cancelling jobs. The queue service handles the persistence operations.- Specified by:
cancelin interfaceJobWorkerService- Parameters:
queued- the job to cancel
-
cancel
public void cancel(io.github.qsy7.queue.api.model.JobExecution jobExecution) To be invoked by the queue service directly for cancelling a specific job execution. The queue service handles the persistence operations.- Specified by:
cancelin interfaceJobWorkerService- Parameters:
jobExecution- the job execution to cancel
-
remove
To be invoked by the AbstractRunnable upon completion or failure.- Specified by:
removein interfaceJobWorkerService- Parameters:
runningFuture- the completed job to remove from the list of running jobs
-
isNoOperation
public boolean isNoOperation() -
getShutdownTimeout
public long getShutdownTimeout() -
getShutdownTimeoutUnits
-
getJobBuilder
-
getWorker
public io.github.qsy7.queue.api.model.Worker getWorker() -
getScheduledThreadPoolExecutor
-
isShutdown
public boolean isShutdown() -
getRunningFutures
-