public final class GenericScheduledExecutorService extends Object implements SchedulerLifecycle
ScheduledExecutorService
that can be used for scheduling actions when a Scheduler
implementation doesn't have that ability.
For example if a Scheduler
is given an Executor
or {ExecutorService
instead of ScheduledExecutorService
.
NOTE: No actual work should be done on tasks submitted to this executor. Submit a task with the appropriate delay which then in turn invokes
the work asynchronously on the appropriate Scheduler
implementation. This means for example that you would not use this approach
along with TrampolineScheduler
or ImmediateScheduler
.
Modifier and Type | Field and Description |
---|---|
static GenericScheduledExecutorService |
INSTANCE |
Modifier and Type | Method and Description |
---|---|
static ScheduledExecutorService |
getInstance()
Returns one of the single-threaded ScheduledExecutorService helper executors.
|
void |
shutdown()
Instructs the Scheduler instance to stop threads
and stop accepting tasks on any outstanding Workers.
|
void |
start()
Allows the Scheduler instance to start threads
and accept tasks on them.
|
public static final GenericScheduledExecutorService INSTANCE
public void start()
SchedulerLifecycle
Implementations should make sure the call is idempotent and thread-safe.
start
in interface SchedulerLifecycle
public void shutdown()
SchedulerLifecycle
Implementations should make sure the call is idempotent and thread-safe.
shutdown
in interface SchedulerLifecycle
public static ScheduledExecutorService getInstance()
ScheduledExecutorService
for generic use.Copyright © 2017. All rights reserved.