private final class AbstractScheduledService.CustomScheduler.ReschedulableCallable
extends java.lang.Object
implements java.util.concurrent.Callable<java.lang.Void>
AbstractScheduledService.CustomScheduler
.Modifier and Type | Field and Description |
---|---|
private AbstractScheduledService.CustomScheduler.SupplantableFuture |
cancellationDelegate
The future that represents the next execution of this task.
|
private java.util.concurrent.ScheduledExecutorService |
executor
The executor on which this Callable will be scheduled.
|
private java.util.concurrent.locks.ReentrantLock |
lock
This lock is used to ensure safe and correct cancellation, it ensures that a new task is
not scheduled while a cancel is ongoing.
|
private AbstractService |
service
The service that is managing this callable.
|
private java.lang.Runnable |
wrappedRunnable
The underlying task.
|
Constructor and Description |
---|
ReschedulableCallable(AbstractService service,
java.util.concurrent.ScheduledExecutorService executor,
java.lang.Runnable runnable) |
Modifier and Type | Method and Description |
---|---|
java.lang.Void |
call() |
private AbstractScheduledService.Cancellable |
initializeOrUpdateCancellationDelegate(AbstractScheduledService.CustomScheduler.Schedule schedule) |
AbstractScheduledService.Cancellable |
reschedule()
Atomically reschedules this task and assigns the new future to
cancellationDelegate . |
private java.util.concurrent.ScheduledFuture<java.lang.Void> |
submitToExecutor(AbstractScheduledService.CustomScheduler.Schedule schedule) |
private final java.lang.Runnable wrappedRunnable
private final java.util.concurrent.ScheduledExecutorService executor
private final AbstractService service
private final java.util.concurrent.locks.ReentrantLock lock
@CheckForNull private AbstractScheduledService.CustomScheduler.SupplantableFuture cancellationDelegate
ReschedulableCallable(AbstractService service, java.util.concurrent.ScheduledExecutorService executor, java.lang.Runnable runnable)
@CheckForNull public java.lang.Void call() throws java.lang.Exception
call
in interface java.util.concurrent.Callable<java.lang.Void>
java.lang.Exception
public AbstractScheduledService.Cancellable reschedule()
cancellationDelegate
.private AbstractScheduledService.Cancellable initializeOrUpdateCancellationDelegate(AbstractScheduledService.CustomScheduler.Schedule schedule)
private java.util.concurrent.ScheduledFuture<java.lang.Void> submitToExecutor(AbstractScheduledService.CustomScheduler.Schedule schedule)