public class SingleThreadContext extends Object implements Context
This is a basic Context implementation that uses a
ScheduledExecutorService to schedule events on the context thread.
| Constructor and Description |
|---|
SingleThreadContext(ScheduledExecutorService executor,
Serializer serializer)
Creates a new single thread context.
|
SingleThreadContext(String name,
Serializer serializer)
Creates a new single thread context.
|
SingleThreadContext(Thread thread,
ScheduledExecutorService executor,
Serializer serializer) |
| 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 SingleThreadContext(String name, Serializer serializer)
The provided context name will be passed to CatalystThreadFactory and used
when instantiating the context thread.
name - The context name.serializer - The context serializer.public SingleThreadContext(ScheduledExecutorService executor, Serializer serializer)
executor - The executor on which to schedule events. This must be a single thread scheduled executor.serializer - The context serializer.public SingleThreadContext(Thread thread, ScheduledExecutorService executor, Serializer 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.