public interface Reactor
getReactor
static method on the
ReactorCore
class.Modifier and Type | Method and Description |
---|---|
<T> Deferred<T> |
callDeferred(T callbackData)
Creates a new deferred event object and then issues a callback on it using
the supplied callback data.
|
void |
cancelThread(Threadable<?,?> threadable)
Cancels a currently executing threadable task.
|
void |
cancelTimer(Timeable<?> timeable)
Cancels the timer associated with a given timeable object.
|
<T> Deferred<T> |
failDeferred(java.lang.Exception error)
Creates a new deferred event object and then issues an error callback on it
using the supplied exception condition.
|
Logger |
getLogger(java.lang.String loggerId)
Gets the runtime message logger which is associated with the specified
logger ID.
|
Logger |
getLogger(java.lang.String loggerId,
java.lang.String loggerResources)
Gets the runtime message logger which is associated with the specified
logger ID.
|
Signal<java.lang.Integer> |
getReactorShutdownSignal()
Gets a handle on the reactor shutdown signal.
|
long |
getUptime()
Gets the elapsed time since the reactor was started.
|
<T> Deferred<T> |
newDeferred()
Creates a new deferred event object.
|
<T> DeferredConcentrator<T> |
newDeferredConcentrator()
Creates a new deferred callback concentrator object.
|
<T> DeferredSplitter<T> |
newDeferredSplitter()
Creates a new deferred callback splitter object.
|
<T> Signal<T> |
newSignal()
Creates a new signal event object.
|
<T,U> Deferred<U> |
runThread(Threadable<T,U> threadable,
T data)
Starts executing a threadable task in a new thread.
|
<T,U> Deferred<U> |
runThread(Threadable<T,U> threadable,
T data,
int msTimeout)
Starts executing a time limited threadable task in a new thread.
|
<T> void |
runTimerOneShot(Timeable<T> timeable,
int msDelay,
T data)
Starts a one-shot timer.
|
<T> void |
runTimerRepeating(Timeable<T> timeable,
int msDelay,
int msInterval,
T data)
Starts a repeating timer.
|
long getUptime()
Logger getLogger(java.lang.String loggerId)
loggerId
- This is the logger ID which is associated with the requested
message logger. This is a String value which will normally hold
the canonical name of the client class which is using the logger.Logger getLogger(java.lang.String loggerId, java.lang.String loggerResources) throws java.util.MissingResourceException
loggerId
- This is the logger ID which is associated with the requested
message logger. This is a String value which will normally hold
the canonical name of the client class which is using the logger.loggerResources
- This is the name of a ResourceBundle
which is to
be used for localising messages for this logger. May be null if
none of the messages require localisation.java.util.MissingResourceException
- This exception will be thrown if a set of logger resources have
been specified but cannot be found.<T> void runTimerOneShot(Timeable<T> timeable, int msDelay, T data) throws ReactorNotRunningException
T
- This type identifier specifies the type of the timer data object
which will be passed as the parameter of the timed callback.timeable
- This is the timeable object which will have its timed callback
executed after the requested delay.msDelay
- This parameter specifies the delay before the timed callback is to
be issued, expressed in milliseconds.data
- This is a timer data object which will be passed back as a
parameter to the timed callback.ReactorNotRunningException
- This runtime exception will be thrown if an attempt is made to
schedule a timer when the reactor is not running.<T> void runTimerRepeating(Timeable<T> timeable, int msDelay, int msInterval, T data) throws ReactorNotRunningException
T
- This type identifier specifies the type of the timer data object
which will be passed as the parameter of the timed callback.timeable
- This is the timeable object which will have its timed callback
executed at the requested interval.msDelay
- This is the delay before the first timed callback is issued,
specified in milliseconds.msInterval
- This is the interval at which timed callbacks will be issued,
specified in milliseconds. If set to 0 or a negative value, the
timer is treated as a one-shot timer.data
- This is a timer data object which will be passed back as a
parameter to the timed callbacks.ReactorNotRunningException
- This exception will be thrown if an attempt is made to schedule a
timer when the reactor is not running.void cancelTimer(Timeable<?> timeable)
timeable
- This is the timeable object for which the associated running timer
should be cancelled.<T,U> Deferred<U> runThread(Threadable<T,U> threadable, T data) throws ReactorNotRunningException, ThreadableRunningException
T
- This type identifier specifies the data type of the parameter
which will be passed as an input to the threadable task.U
- This type identifier specifies the data type of the value which
will be returned by the threadable task.threadable
- This is the threadable task object which is to be executed in a
separate thread.data
- This is the input data object which will be passed to the
run
method of the threadable task
object when it is called in the context of the new thread.ReactorNotRunningException
- This exception will be thrown if an attempt is made to schedule
execution of a threadable task object when the reactor is not
running.ThreadableRunningException
- This runtime exception is thrown when an attempt is made to
schedule a threadable object for execution while it is already
being processed by the reactor. This constitutes a programming
error.<T,U> Deferred<U> runThread(Threadable<T,U> threadable, T data, int msTimeout) throws ReactorNotRunningException, ThreadableRunningException
DeferredTimedOutException
is passed back via the errback chain.T
- This type identifier specifies the data type of the parameter
which will be passed as an input to the threadable task.U
- This type identifier specifies the data type of the value which
will be returned by the threadable task.threadable
- This is the threadable task object which is to be executed in a
separate thread.data
- This is the input data object which will be passed to the
run
method of the threadable task
object when it is called in the context of the new thread.msTimeout
- This is the timeout period which is associated with the threadable
task. A threadable task which exceeds this duration will be
automatically cancelled.DeferredTimedOutException
.ReactorNotRunningException
- This exception will be thrown if an attempt is made to schedule
execution of a threadable task object when the reactor is not
running.ThreadableRunningException
- This runtime exception is thrown when an attempt is made to
schedule a threadable object for execution while it is already
being processed by the reactor. This constitutes a programming
error.void cancelThread(Threadable<?,?> threadable)
threadable
- This is the threadable task object for which threaded execution is
to be cancelled.<T> Deferred<T> newDeferred()
Deferred
interface.T
- This type identifier specifies the data type of the object which
should be passed as the callback
parameter for the new deferred event object.<T> Deferred<T> callDeferred(T callbackData)
T
- This type identifier specifies the data type of the object which
should be passed as the callback data for the new deferred event
object.callbackData
- This is the callback data which is to be passed to the deferred
callback chain.<T> Deferred<T> failDeferred(java.lang.Exception error)
T
- This type identifier specifies the data type of the object which
would otherwise have been passed as the callback data for the new
deferred event object.error
- This is the exception condition which is to be passed to the
deferred error callback chain.<T> DeferredSplitter<T> newDeferredSplitter()
DeferredSplitter
interface.T
- This type identifier specifies the type of the callback data
object which will be passed through the deferred splitter.<T> DeferredConcentrator<T> newDeferredConcentrator()
DeferredConcentrator
interface.T
- This type identifier specifies the type of the callback data
object which will be passed through the deferred concentrator.<T> Signal<T> newSignal()
Signal
interface.T
- This type identifier specifies the type of the data object which
will be passed as the parameter to the
onSignal
signalable
callbacks.Signal<java.lang.Integer> getReactorShutdownSignal()