public class ThreadPoolContext extends AbstractThreadContext
This is a special ThreadContext implementation that schedules events to be executed
on a thread pool. Events executed by this context are guaranteed to be executed on order but may be executed on different
threads in the provided thread pool.
| Constructor and Description |
|---|
ThreadPoolContext(ScheduledExecutorService parent)
Creates a new thread pool context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the context.
|
void |
execute(Runnable command) |
Scheduled |
schedule(Duration delay,
Duration interval,
Runnable runnable)
Schedules a runnable at a fixed rate.
|
Scheduled |
schedule(Duration delay,
Runnable runnable)
Schedules a runnable after a delay.
|
block, isBlocked, unblockequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckThread, currentContext, currentContextOrThrow, isCurrentContextpublic ThreadPoolContext(ScheduledExecutorService parent)
parent - The thread pool on which to execute events.public void execute(Runnable command)
public Scheduled schedule(Duration delay, Runnable runnable)
Schedulerdelay - the delay after which to run the callbackrunnable - the callback to runpublic Scheduled schedule(Duration delay, Duration interval, Runnable runnable)
Schedulerdelay - the initial delayinterval - the interval at which to run the callbackrunnable - the callback to runpublic void close()
ThreadContextCopyright © 2013–2018. All rights reserved.