final class InvokerStrategy extends SchedulingStrategy
SchedulingStrategy| Modifier and Type | Field and Description |
|---|---|
private java.util.Queue<java.lang.Thread> |
activeThreads |
| Modifier | Constructor and Description |
|---|---|
protected |
InvokerStrategy(ConsoleStream logger) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
destroy()
Calling
ThreadPoolExecutor.shutdown()
and ThreadPoolExecutor.awaitTermination(long, java.util.concurrent.TimeUnit). |
boolean |
finished()
Waiting for scheduled tasks to finish.
|
boolean |
hasSharedThreadPool() |
void |
schedule(java.lang.Runnable task)
Schedules tasks if
SchedulingStrategy.canSchedule(). |
protected boolean |
stop()
Stops scheduling new tasks (e.g.
|
protected boolean |
stopNow()
Stops scheduling new tasks and
interrupts running tasks
(e.g. |
canSchedule, disable, logQuietly, setDefaultShutdownHandlerprotected InvokerStrategy(ConsoleStream logger)
public void schedule(java.lang.Runnable task)
SchedulingStrategySchedulingStrategy.canSchedule().schedule in class SchedulingStrategytask - runnable to schedule in a thread pool or invokeRunnerScheduler.schedule(Runnable),
Executor.execute(Runnable)protected boolean stop()
SchedulingStrategyExecutorService.shutdown()
on a private thread pool which cannot be shared with other strategy).stop in class SchedulingStrategytrue if successfully stopped the scheduler, else
false if already stopped (a shared thread
pool was shutdown externally).ExecutorService.shutdown()protected boolean stopNow()
SchedulingStrategyinterrupts running tasks
(e.g. by ExecutorService.shutdownNow() on a private thread pool
which cannot be shared with other strategy).
SchedulingStrategy.stop() by default.stopNow in class SchedulingStrategytrue if successfully stopped the scheduler, else
false if already stopped (a shared thread
pool was shutdown externally).ExecutorService.shutdownNow()public boolean hasSharedThreadPool()
hasSharedThreadPool in class SchedulingStrategytrue if a thread pool associated with this strategy
can be shared with other strategies.public boolean finished()
throws java.lang.InterruptedException
SchedulingStrategyfinished in class SchedulingStrategytrue if successfully stopped the scheduler, else
false if already stopped (a shared thread
pool was shutdown externally).java.lang.InterruptedException - if interrupted while waiting
for scheduled tasks to finishRunnerScheduler.finished()public boolean destroy()
DestroyableThreadPoolExecutor.shutdown()
and ThreadPoolExecutor.awaitTermination(long, java.util.concurrent.TimeUnit).true if not interrupted in current thread