public class ThreadPoolContext extends Object implements Context
This is a special Context 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,
Serializer serializer)
Creates a new thread pool context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the context.
|
Executor |
executor()
Returns the underlying executor.
|
org.slf4j.Logger |
logger()
Returns the context logger.
|
Scheduled |
schedule(Runnable runnable,
Duration delay)
Schedules a runnable on the context.
|
Scheduled |
schedule(Runnable runnable,
Duration delay,
Duration interval)
Schedules a runnable at a fixed rate on the context.
|
Serializer |
serializer()
Returns the context serializer.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckThread, currentContext, execute, executepublic ThreadPoolContext(ScheduledExecutorService parent, Serializer serializer)
parent - The thread pool on which to execute events.serializer - The context serializer.public org.slf4j.Logger logger()
Contextpublic Serializer serializer()
Contextserializer in interface Contextpublic Executor executor()
Contextpublic Scheduled schedule(Runnable runnable, Duration delay)
Contextpublic Scheduled schedule(Runnable runnable, Duration delay, Duration interval)
Contextpublic void close()
Contextclose in interface AutoCloseableclose in interface ContextCopyright © 2013–2015. All rights reserved.