public class ThreadPoolContext extends Object implements ThreadContext
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.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckThread, currentContext, currentContextOrThrow, isCurrentContextpublic ThreadPoolContext(ScheduledExecutorService parent)
parent - The thread pool on which to execute events.public Scheduled schedule(Duration delay, Runnable runnable)
Schedulerpublic Scheduled schedule(Duration delay, Duration interval, Runnable runnable)
Schedulerpublic void close()
ThreadContextclose in interface ThreadContextclose in interface AutoCloseableCopyright © 2013–2017. All rights reserved.