javax.realtime
Class AsyncEventHandler

java.lang.Object
  |
  +--javax.realtime.AsyncEventHandler
All Implemented Interfaces:
java.lang.Runnable, Schedulable
Direct Known Subclasses:
BoundAsyncEventHandler

public class AsyncEventHandler
extends java.lang.Object
implements Schedulable

An asynchronous event handler encapsulates code that gets run at some time after an AsyncEvent occurs.

It is essentially a java.lang.Runnable with a set of parameter objects, making it very much like RealtimeThread. The expectation is that there may be thousands of events, with corresponding handlers, averaging about one handler per event. The number of unblocked (i.e., scheduled) handlers is expected to be relatively small.

It is guaranteed that multiple firings of an event handler will be serialized. It is also guaranteed that (unless the handler explicitly chooses otherwise) for each firing of the handler, there will be one execution of the handleAsyncEvent method.

For instances of AsyncEventHandler with a release parameter of type SporadicParameters have a list of release times which correspond to execution times of AsyncEvent.fire(). The minimum interarrival time specified in SporadicParameters is enforced as defined there. Unless the handler explicitly chooses otherwise there will be one execution of the code in handleAsyncEvent for each entry in the list. The i-th execution of handleAsyncEvent will be realeased for scheduling at the time of the i-th entry in the list.

The is no restriction on what handlers may do. They may run for a long or short time, and they may block. (Note: blocked handlers may hold system resources).

Normally, handlers are bound to an execution context dynamically, when their AsyncEvent occurs. This can introduce a (small) time penalty. For critical handlers that can not afford the expense, and where this penalty is a problem, use a BoundAsyncEventHandler.

The semantics for memory areas that were defined for realtime threads apply in the same way to instances of AsyncEventHandler. They may inherit a scope stack when they are created, and the single parent rule applies to the use of memory scopes for instances of AsyncEventHandler just as it does in realtime threads.


Field Summary
protected  javax.realtime.Scheduler currentScheduler
           
protected  int fireCount
           
protected  javax.realtime.ProcessingGroupParameters group
           
protected  java.lang.Runnable logic
           
protected  javax.realtime.MemoryArea memArea
           
protected  javax.realtime.MemoryParameters memParams
           
private  long myUID
           
protected  boolean nonheap
           
protected  javax.realtime.ReleaseParameters release
           
protected  javax.realtime.SchedulingParameters scheduling
           
private static long UID
           
 
Constructor Summary
AsyncEventHandler()
          Create an instance of AsyncEventHandler whose SchedulingParameters are inherited from the current thread and does not have either ReleaseParameters or MemoryParameters.
AsyncEventHandler(boolean nonheap)
          Create an instance of AsyncEventHandler whose parameters are inherited from the current thread, if the current thread is a RealtimeThread, or null, otherwise.
AsyncEventHandler(java.lang.Runnable logic)
          Create an instance of AsyncEventHandler whose SchedulingParameters are inherited from the current thread and does not have either ReleaseParameters or MemoryParameters.
AsyncEventHandler(java.lang.Runnable logic, boolean nonheap)
          Create an instance of AsyncEventHandler whose parameters are inherited from the current thread, if the current thread is a RealtimeThread, or null, otherwise.
AsyncEventHandler(javax.realtime.SchedulingParameters scheduling, javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memory, javax.realtime.MemoryArea area, javax.realtime.ProcessingGroupParameters group, boolean nonheap)
          Create an instance of AsyncEventHandler whose parameters are inherited from the current thread, if the current thread is a RealtimeThread, or null, otherwise.
AsyncEventHandler(javax.realtime.SchedulingParameters scheduling, javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memory, javax.realtime.MemoryArea area, javax.realtime.ProcessingGroupParameters group, boolean nonheap, java.lang.Runnable logic)
          Create an instance of AsyncEventHandler whose parameters are inherited from the current thread, if the current thread is a RealtimeThread, or null, otherwise.
AsyncEventHandler(javax.realtime.SchedulingParameters scheduling, javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memory, javax.realtime.MemoryArea area, javax.realtime.ProcessingGroupParameters group, java.lang.Runnable logic)
          Create an instance of AsyncEventHandler whose parameters are inherited from the current thread, if the current thread is a RealtimeThread, or null, otherwise.
 
Method Summary
 boolean addIfFeasible()
          Inform the scheduler and cooperating facilities that the feasibility parameters associated with this should be considered in feasibility analyses until further notified, only if the new set of parameters is feasible.
 boolean addToFeasibility()
          Inform the scheduler and cooperating facilities that the feasibility parameters associated with this should be considered in feasibility analyses until further notified.
protected  int getAndClearPendingFireCount()
          This is an accessor method for fireCount.
protected  int getAndDecrementPendingFireCount()
          This is an accessor method for fireCount.
protected  int getAndIncrementPendingFireCount()
          This is an accessor method for fireCount.
 javax.realtime.MemoryArea getMemoryArea()
          This is an accessor method for the intance of MemoryArea associated with this.
 javax.realtime.MemoryParameters getMemoryParameters()
          Gets the memory parameters associated with this instance of Schedulable.
protected  int getPendingFireCount()
          This is an accessor method for fireCount.
 javax.realtime.ProcessingGroupParameters getProcessingGroupParameters()
          Gets the processing group parameters associated with this intance of Schedulable.
 javax.realtime.ReleaseParameters getReleaseParameters()
          Gets the release parameters associated with this instance of Schedulable.
 javax.realtime.Scheduler getScheduler()
          Gets the instance of Scheduler associated with this instance of Schedulable.
 javax.realtime.SchedulingParameters getSchedulingParameters()
          Gets the scheduling parameters associated with this instance of Schedulable.
 long getUID()
          Return a UID for this Schedulable object.
 void handleAsyncEvent()
          This method holds the logic which is to be executed when assiciated instances of AsyncEvent occur.
 void removeFromFeasibility()
          Inform the scheduler and cooperating facilities that the scheduling characteristics of this instance of Schedulable should not be considered in feasibility analyses until further notified.
 void run()
          Used by the asynchronous event mechanism, see AsyncEvent.
 boolean setIfFeasible(javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memory)
          This method appears in many classes in the RTSJ and with various parameters.
 boolean setIfFeasible(javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memory, javax.realtime.ProcessingGroupParameters group)
          This method appears in many classes in the RTSJ and with various parameters.
 boolean setIfFeasible(javax.realtime.ReleaseParameters release, javax.realtime.ProcessingGroupParameters group)
          This method appears in many classes in the RTSJ and with various parameters.
 void setMemoryParameters(javax.realtime.MemoryParameters memory)
          Sets the memory parameters associated with this instance of Schedulable.
 boolean setMemoryParametersIfFeasible(javax.realtime.MemoryParameters memory)
          The method first performs a feasibility analysis using the given memory parameters as replacements for the memory parameters of this.
 void setProcessingGroupParameters(javax.realtime.ProcessingGroupParameters group)
          Sets the processing group parameters associated with this instance of Schedulable.
 boolean setProcessingGroupParametersIfFeasible(javax.realtime.ProcessingGroupParameters group)
          The method first performs a feasibility analysis using the given processing group parameters as replacements for the processing group parameters of this.
 void setReleaseParameters(javax.realtime.ReleaseParameters release)
          Set the realease parameters associated with this instance of Schedulable.
 boolean setReleaseParametersIfFeasible(javax.realtime.ReleaseParameters release)
          The method first performs a feasibility analysis using the given release parameters as replacements for the release parameters of this.
 void setScheduler(javax.realtime.Scheduler scheduler)
          Sets the scheduler associated with this instance of Schedulable.
 void setScheduler(javax.realtime.Scheduler scheduler, javax.realtime.SchedulingParameters scheduling, javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memoryParameters, javax.realtime.ProcessingGroupParameters processingGroup)
          Sets the scheduler associated with this instance of Schedulable.
 void setSchedulingParameters(javax.realtime.SchedulingParameters scheduling)
          Sets the scheduling parameters associated with this instance of Schedulable.
 boolean setSchedulingParametersIfFeasible(javax.realtime.SchedulingParameters scheduling)
          The method first performs a feasibility analysis using the given scheduling parameters as replacements for the scheduling parameters of this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fireCount

protected int fireCount

nonheap

protected boolean nonheap

logic

protected java.lang.Runnable logic

currentScheduler

protected javax.realtime.Scheduler currentScheduler

scheduling

protected javax.realtime.SchedulingParameters scheduling

release

protected javax.realtime.ReleaseParameters release

memParams

protected javax.realtime.MemoryParameters memParams

memArea

protected javax.realtime.MemoryArea memArea

group

protected javax.realtime.ProcessingGroupParameters group

UID

private static long UID

myUID

private long myUID
Constructor Detail

AsyncEventHandler

public AsyncEventHandler()
Create an instance of AsyncEventHandler whose SchedulingParameters are inherited from the current thread and does not have either ReleaseParameters or MemoryParameters.


AsyncEventHandler

public AsyncEventHandler(boolean nonheap)
Create an instance of AsyncEventHandler whose parameters are inherited from the current thread, if the current thread is a RealtimeThread, or null, otherwise.

Parameters:
nonheap - A flag meaning, when true, that this will have characteristics identical to a NoHeapRealtimeThread. A false value means this will have characteristics identical to a RealtimeThread. If true and the current thread is not a NoHeapRealtimeThread of a RealtimeThread executing within a ScopedMemory or ImmortalMemory scope then an IllegalArgumentException is thrown.
Throws:
java.lang.IllegalArgumentException - If the initial memory area is in heap memory, and the nonheap parameter is true.

AsyncEventHandler

public AsyncEventHandler(java.lang.Runnable logic)
Create an instance of AsyncEventHandler whose SchedulingParameters are inherited from the current thread and does not have either ReleaseParameters or MemoryParameters.

Parameters:
logic - The java.lang.Runnable object whose run() method is executed by handleAsyncEvent().

AsyncEventHandler

public AsyncEventHandler(java.lang.Runnable logic,
                         boolean nonheap)
Create an instance of AsyncEventHandler whose parameters are inherited from the current thread, if the current thread is a RealtimeThread, or null, otherwise.

Parameters:
nonheap - A flag meaning, when true, that this will have characteristics identical to a NoHeapRealtimeThread. A false value means this will have characteristics identical to a RealtimeThread. If true and the current thread is not a NoHeapRealtimeThread of a RealtimeThread executing within a ScopedMemory or ImmortalMemory scope then an IllegalArgumentException is thrown.
Throws:
java.lang.IllegalArgumentException - If the initial memory area is in heap memory, and the nonheap parameter is true.

AsyncEventHandler

public AsyncEventHandler(javax.realtime.SchedulingParameters scheduling,
                         javax.realtime.ReleaseParameters release,
                         javax.realtime.MemoryParameters memory,
                         javax.realtime.MemoryArea area,
                         javax.realtime.ProcessingGroupParameters group,
                         boolean nonheap)
Create an instance of AsyncEventHandler whose parameters are inherited from the current thread, if the current thread is a RealtimeThread, or null, otherwise.

Parameters:
scheduling - A SchedulingParameters object which will be associated with the constructed instance. If null, this will be assigned the reference to the SchedulingParameters of the current thread.
release - A ReleaseParameters obejct which will be associated with the constructed isntance. If null, this will have no ReleaseParameters.
memory - A MemoryParameters object which will be associated with the constructed intance. If null, this will have no MemoryParameters.
area - The MemoryArea for this. If null, the memory area will be that of the current thread.
group - A ProcessingGroupParamters object which will be associated with the constructed instance. If null, will not be associated with any processing group.
nonheap - A flag meaning, when true, that this will have characteristics identical to a NoHeapRealtimeThread. A false value means this will have characteristics identical to a RealtimeThread. If true and the current thread is not a NoHeapRealtimeThread of a RealtimeThread executing within a ScopedMemory or ImmortalMemory scope then an IllegalArgumentException is thrown.
Throws:
java.lang.IllegalArgumentException - If the initial memory area is in heap memory, and the nonheap parameter is true.

AsyncEventHandler

public AsyncEventHandler(javax.realtime.SchedulingParameters scheduling,
                         javax.realtime.ReleaseParameters release,
                         javax.realtime.MemoryParameters memory,
                         javax.realtime.MemoryArea area,
                         javax.realtime.ProcessingGroupParameters group,
                         java.lang.Runnable logic)
Create an instance of AsyncEventHandler whose parameters are inherited from the current thread, if the current thread is a RealtimeThread, or null, otherwise.

Parameters:
scheduling - A SchedulingParameters object which will be associated with the constructed instance. If null, this will be assigned the reference to the SchedulingParameters of the current thread.
release - A ReleaseParameters obejct which will be associated with the constructed isntance. If null, this will have no ReleaseParameters.
memory - A MemoryParameters object which will be associated with the constructed intance. If null, this will have no MemoryParameters.
area - The MemoryArea for this. If null, the memory area will be that of the current thread.
group - A ProcessingGroupParamters object which will be associated with the constructed instance. If null, will not be associated with any processing group.
logic - The java.lang.Runnable object whose run() method is executed by handleAsyncEvent().
Throws:
java.lang.IllegalArgumentException - If the initial memory area is in heap memory, and the nonheap parameter is true.

AsyncEventHandler

public AsyncEventHandler(javax.realtime.SchedulingParameters scheduling,
                         javax.realtime.ReleaseParameters release,
                         javax.realtime.MemoryParameters memory,
                         javax.realtime.MemoryArea area,
                         javax.realtime.ProcessingGroupParameters group,
                         boolean nonheap,
                         java.lang.Runnable logic)
Create an instance of AsyncEventHandler whose parameters are inherited from the current thread, if the current thread is a RealtimeThread, or null, otherwise.

Parameters:
scheduling - A SchedulingParameters object which will be associated with the constructed instance. If null, this will be assigned the reference to the SchedulingParameters of the current thread.
release - A ReleaseParameters obejct which will be associated with the constructed isntance. If null, this will have no ReleaseParameters.
memory - A MemoryParameters object which will be associated with the constructed intance. If null, this will have no MemoryParameters.
area - The MemoryArea for this. If null, the memory area will be that of the current thread.
group - A ProcessingGroupParamters object which will be associated with the constructed instance. If null, will not be associated with any processing group.
logic - The java.lang.Runnable object whose run() method is executed by handleAsyncEvent().
nonheap - A flag meaning, when true, that this will have characteristics identical to a NoHeapRealtimeThread. A false value means this will have characteristics identical to a RealtimeThread. If true and the current thread is not a NoHeapRealtimeThread of a RealtimeThread executing within a ScopedMemory or ImmortalMemory scope then an IllegalArgumentException is thrown.
Throws:
java.lang.IllegalArgumentException - If the initial memory area is in heap memory, and the nonheap parameter is true.
Method Detail

addIfFeasible

public boolean addIfFeasible()
Inform the scheduler and cooperating facilities that the feasibility parameters associated with this should be considered in feasibility analyses until further notified, only if the new set of parameters is feasible.

Specified by:
addIfFeasible in interface Schedulable
Returns:
True if the additions is successful. False if the addition is not successful or there is no assigned scheduler.

addToFeasibility

public boolean addToFeasibility()
Inform the scheduler and cooperating facilities that the feasibility parameters associated with this should be considered in feasibility analyses until further notified.

Specified by:
addToFeasibility in interface Schedulable
Returns:
True, if the addition was successful. False, if not.

getAndClearPendingFireCount

protected final int getAndClearPendingFireCount()
This is an accessor method for fireCount. This method atomically sets the value of fireCount to zero and returns the value from before it was set to zero. This may be used by handlers for which the logic can accommodate multiple firings in a single execution. The general form for using this is:

public void handleAsyncEvent() { int numberOfFirings = getAndClearPendingFireCount(); }

Returns:
The value held by fireCount prior to setting the value to zero.

getAndDecrementPendingFireCount

protected int getAndDecrementPendingFireCount()
This is an accessor method for fireCount. This method atomically decrements, by one, the value of fireCount (if it was greater than zero) and returns the value from before the decrement. This method can be used in the handleAsyncEvent method to handle multiple firings:

public void handleAsyncEvent() { do { } while (getAndDecrementPendingFireCounts() > 0); }

This construction is necessary only in the case where one wishes to avoid the setup costs since the framework guarantees that handleAsyncEvent() will be invoked the appropriate number of times.

Returns:
The value held by fireCount prior to decrementing it by one.

getAndIncrementPendingFireCount

protected int getAndIncrementPendingFireCount()
This is an accessor method for fireCount. This method atomically increments, by one, the value of fireCount and return the value from before the increment.

Returns:
The value held by fireCount prior to incrementing it by one.

getMemoryArea

public javax.realtime.MemoryArea getMemoryArea()
This is an accessor method for the intance of MemoryArea associated with this.

Returns:
The instance of MemoryArea which is the current area for this.

getMemoryParameters

public javax.realtime.MemoryParameters getMemoryParameters()
Gets the memory parameters associated with this instance of Schedulable.

Specified by:
getMemoryParameters in interface Schedulable
Returns:
The MemoryParameters object associated with this.

getPendingFireCount

protected final int getPendingFireCount()
This is an accessor method for fireCount. The fireCount field nominally holds the number of times associated instance of AsyncEvent have occured that have not had the method handleAsyncEvent() invoked. Due to accessor methods the pplication logic may manipulate the value in this field for application specific reasons.

Returns:
The value held by fireCount.

getProcessingGroupParameters

public javax.realtime.ProcessingGroupParameters getProcessingGroupParameters()
Gets the processing group parameters associated with this intance of Schedulable.

Specified by:
getProcessingGroupParameters in interface Schedulable
Returns:
The ProcessingGroupParameters object associated with this.

getReleaseParameters

public javax.realtime.ReleaseParameters getReleaseParameters()
Gets the release parameters associated with this instance of Schedulable.

Specified by:
getReleaseParameters in interface Schedulable
Returns:
The ReleaseParameters object associated with this.

getScheduler

public javax.realtime.Scheduler getScheduler()
Gets the instance of Scheduler associated with this instance of Schedulable.

Specified by:
getScheduler in interface Schedulable
Returns:
The instance of Scheduler associated with this.

getSchedulingParameters

public javax.realtime.SchedulingParameters getSchedulingParameters()
Gets the scheduling parameters associated with this instance of Schedulable.

Specified by:
getSchedulingParameters in interface Schedulable
Returns:
The SchedulingParameters object associated with this.

handleAsyncEvent

public void handleAsyncEvent()
This method holds the logic which is to be executed when assiciated instances of AsyncEvent occur. If this handler was constructed using an instance of java.lang.Runnable as an argument to the constructor, then that instance's run() method will be invoked from this method. This method will be invoked repreadedly while fireCount is greater than zero.


removeFromFeasibility

public void removeFromFeasibility()
Inform the scheduler and cooperating facilities that the scheduling characteristics of this instance of Schedulable should not be considered in feasibility analyses until further notified.

Specified by:
removeFromFeasibility in interface Schedulable
Returns:
True, if the removal was successful. False, if the removal was unsuccessful.

run

public final void run()
Used by the asynchronous event mechanism, see AsyncEvent. This method invokes handleAsyncEvent() repeatedly while fire count is greater than zero. Applications cannot override this method and should thus override handleAsyncEvent() in subclasses with the logic of the handler.

Specified by:
run in interface java.lang.Runnable

setIfFeasible

public boolean setIfFeasible(javax.realtime.ReleaseParameters release,
                             javax.realtime.MemoryParameters memory)
This method appears in many classes in the RTSJ and with various parameters. The parameters are either new scheduling characteristics for an instance Schedulable or an instance of Schedulable. The method first performs a feasibility analysis using the new scheduling characteristics as replacements for the matching scheduling characteristics of either this or the given instance of Schedulable. If the resulting system is feasible the method replaces the current scheduling characteristics, of either this or the given instance of Schedulable as appropriate, with the new scheduling characteristics.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
release - The proposed release parameters.
memory - The proposed memory parameters.
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.

setIfFeasible

public boolean setIfFeasible(javax.realtime.ReleaseParameters release,
                             javax.realtime.MemoryParameters memory,
                             javax.realtime.ProcessingGroupParameters group)
This method appears in many classes in the RTSJ and with various parameters. The parameters are either new scheduling characteristics for an instance Schedulable or an instance of Schedulable. The method first performs a feasibility analysis using the new scheduling characteristics as replacements for the matching scheduling characteristics of either this or the given instance of Schedulable. If the resulting system is feasible the method replaces the current scheduling characteristics, of either this or the given instance of Schedulable as appropriate, with the new scheduling characteristics.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
release - The proposed release parameters.
memory - The proposed memory parameters.
group - The proposed processing group parameters.
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.

setIfFeasible

public boolean setIfFeasible(javax.realtime.ReleaseParameters release,
                             javax.realtime.ProcessingGroupParameters group)
This method appears in many classes in the RTSJ and with various parameters. The parameters are either new scheduling characteristics for an instance Schedulable or an instance of Schedulable. The method first performs a feasibility analysis using the new scheduling characteristics as replacements for the matching scheduling characteristics of either this or the given instance of Schedulable. If the resulting system is feasible the method replaces the current scheduling characteristics, of either this or the given instance of Schedulable as appropriate, with the new scheduling characteristics.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
release - The proposed release parameters.
group - The proposed processing group parameters.
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.

setMemoryParameters

public void setMemoryParameters(javax.realtime.MemoryParameters memory)
Sets the memory parameters associated with this instance of Schedulable. When is is next executed, that execution will use the new parameters to control memory allocation. Does not affect the current invocation of the run() of this handler.

Specified by:
setMemoryParameters in interface Schedulable
Parameters:
memory - A MemoryParameters object which will become the memory parameters associated with this after the method call.

setMemoryParametersIfFeasible

public boolean setMemoryParametersIfFeasible(javax.realtime.MemoryParameters memory)
The method first performs a feasibility analysis using the given memory parameters as replacements for the memory parameters of this. If the resulting system is feasible the method replaces the current memory parameters of this with the new memory parameters.

Specified by:
setMemoryParametersIfFeasible in interface Schedulable
Parameters:
memory - The proposed memory parameters.
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.

setProcessingGroupParameters

public void setProcessingGroupParameters(javax.realtime.ProcessingGroupParameters group)
Sets the processing group parameters associated with this instance of Schedulable.

Specified by:
setProcessingGroupParameters in interface Schedulable
Parameters:
group - The ProcessingGroupParameters object. If null, nothing happens.
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.

setProcessingGroupParametersIfFeasible

public boolean setProcessingGroupParametersIfFeasible(javax.realtime.ProcessingGroupParameters group)
The method first performs a feasibility analysis using the given processing group parameters as replacements for the processing group parameters of this. If the resulting system is feasible the method replaces the current processing group parameters of this with the new processing group parameters.

Specified by:
setProcessingGroupParametersIfFeasible in interface Schedulable
Parameters:
group - The proposed processing group parameters.
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.

setReleaseParameters

public void setReleaseParameters(javax.realtime.ReleaseParameters release)
Set the realease parameters associated with this instance of Schedulable. When it is next executed, that execution will use the new parameters to control scheduling. If the scheduling parameters of a handler is set to null, the handler will be executed immediately when any associated AsyncEvent is fired, in the context of the thread invoking the fire() method. Does not affect the current invocation of the run() of this handler.

Specified by:
setReleaseParameters in interface Schedulable
Parameters:
release - A ReleaseParameters object which will become the release parameters associated with this after the method call.

setReleaseParametersIfFeasible

public boolean setReleaseParametersIfFeasible(javax.realtime.ReleaseParameters release)
The method first performs a feasibility analysis using the given release parameters as replacements for the release parameters of this. If the resulting system is feasible the method replaces the current release parameters of this with the new release parameters.

Specified by:
setReleaseParametersIfFeasible in interface Schedulable
Parameters:
release - The proposed release parameters.
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.

setScheduler

public void setScheduler(javax.realtime.Scheduler scheduler)
                  throws java.lang.IllegalThreadStateException
Sets the scheduler associated with this instance of Schedulable.

Specified by:
setScheduler in interface Schedulable
Parameters:
scheduler - An instance of Scheduler which will manage the execution of this thread. If scheduler is null nothing happens.
Throws:
java.langIllegalThreadStateException
java.lang.IllegalThreadStateException - Thrown when: ((Thread.isAlive() && Not Blocked) == true). (Where blocked means waiting in Thread.wait(), Thread.join() or Thread.sleep()).

setScheduler

public void setScheduler(javax.realtime.Scheduler scheduler,
                         javax.realtime.SchedulingParameters scheduling,
                         javax.realtime.ReleaseParameters release,
                         javax.realtime.MemoryParameters memoryParameters,
                         javax.realtime.ProcessingGroupParameters processingGroup)
                  throws java.lang.IllegalThreadStateException
Sets the scheduler associated with this instance of Schedulable.

Specified by:
setScheduler in interface Schedulable
Parameters:
scheduler - An instance of Scheduler which will manage the execution of this thread. If scheduler is null nothing happens.
scheduling - A SchedulingParameters object which will be associated with this. If null, this will be assigned the reference to the instance of SchedulingParameters of the current thread.
release - A ReleaseParameters object which will be associated with this. If null, this will have no associated instance of ReleaseParameters.
memoryParameters - A MemoryParameters object which will be associated with this. If null, this will have no associated instance of MemoryParameters.
processingGroup - A reference to the ProcessingGroupParameters which will be associated with this. If null, no change to current value of this parameter is made.
Throws:
java.lang.IllegalThreadStateException

setSchedulingParameters

public void setSchedulingParameters(javax.realtime.SchedulingParameters scheduling)
Sets the scheduling parameters associated with this instance of Schedulable. When it is next executed, that execution will use the new parameters to control releases. If the scheduling parameters of a handler is set to null, the handler will be executed immediately when any associated AsycnEvent is fired, in the context of the thread invoking the fire() method. Does not affect the current invocation of the run() of this handler.

Specified by:
setSchedulingParameters in interface Schedulable
Parameters:
scheduling - A SchedulingParameters object which will become the scheduling parameters associated with this after the method call.

setSchedulingParametersIfFeasible

public boolean setSchedulingParametersIfFeasible(javax.realtime.SchedulingParameters scheduling)
The method first performs a feasibility analysis using the given scheduling parameters as replacements for the scheduling parameters of this. If the resulting system is feasible the method replaces the current scheduling parameters of this with new scheduling parameters.

Specified by:
setSchedulingParametersIfFeasible in interface Schedulable
Parameters:
scheduling - The proposed scheduling parameters.
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.

getUID

public long getUID()
Description copied from interface: Schedulable
Return a UID for this Schedulable object.

Specified by:
getUID in interface Schedulable