public abstract class ReleaseRunner
extends java.lang.Object
ConfigurationParameters
,
RealtimeThreadGroup
, and Affinity
.
The other parameters for instances of Schedulable
can either be
set for each release or be configurable for the pool. In the latter case,
one should not be able to associate a handler with the runner that has an
incompatible parameter set. These other parameters are
SchedulingParameters
, ReleaseParameters
, and
MemoryParameters
, as well as the MemoryArea
in which the
release should take place.
The default release runner, FirstInFirstOutReleaseRunner
,
sets these other parameters on the releasing thread at each
release. Since there may be a performance penalty for doing this,
an application can define its own release runners for commonly
occurring cases of these parameters. It is then up to the
application to ensure that handlers are matched to the correct
release runner.
Modifier and Type | Class and Description |
---|---|
static interface |
ReleaseRunner.Proxy
An interface to encapsulate the execution contexts for running
an instance of
AsyncBaseEventHandler . |
Modifier | Constructor and Description |
---|---|
protected |
ReleaseRunner(RealtimeThreadGroup group)
Enables creating a subclass of this class.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
attach(ReleaseRunner.Proxy handler)
Notifies this runner that the handler is now associated with it.
|
protected abstract void |
detach(ReleaseRunner.Proxy handler)
Notifies this runner that the handler is no longer associated with it.
|
abstract ConfigurationParameters |
getConfigurationParameters()
Get the
ConfigurationParameters object used for all threads
provided by this release runner. |
protected abstract RealtimeThreadGroup |
getRealtimeThreadGroup()
Determine the
RealtimeThreadGroup instance used. |
protected abstract void |
release(ReleaseRunner.Proxy handler)
Finds a thread and has it call the
Runnable.run()
method. |
protected ReleaseRunner(RealtimeThreadGroup group)
protected abstract RealtimeThreadGroup getRealtimeThreadGroup()
RealtimeThreadGroup
instance used.RealtimeThreadGroup
instance used by all threads
used for running releases.public abstract ConfigurationParameters getConfigurationParameters()
ConfigurationParameters
object used for all threads
provided by this release runner.protected abstract void release(ReleaseRunner.Proxy handler)
Runnable.run()
method. Care should be exercised when implementing this method, since
it adds to both the latency and jitter of releasing events. The caller
must guarantee that releases of any given handler are always executed in
order.
This method should only be called from the infrastructure.
handler
- The handler to be released.protected abstract void attach(ReleaseRunner.Proxy handler) throws StaticIllegalStateException, ProcessorAffinityException
This method should only be called from the infrastructure.
handler
- The handler to be attachedStaticIllegalStateException
- when handler
is
already attached.ProcessorAffinityException
- when handler
is
has an illegal affinity.protected abstract void detach(ReleaseRunner.Proxy handler) throws StaticIllegalStateException
This method should only be called from the infrastructure.
handler
- The handler to be removedStaticIllegalStateException
- when handler
is not attached.