aicas logoJamaica 6.1 release 1

javax.realtime
Class AsyncEventHandler

java.lang.Object
  extended by javax.realtime.AsyncEventHandler
All Implemented Interfaces:
java.lang.Runnable, Schedulable
Direct Known Subclasses:
BoundAsyncEventHandler

public class AsyncEventHandler
extends java.lang.Object
implements Schedulable

Jamaica Real-Time Specification for Java class AsyncEventHandler.

An instance of this class contains code that will be released for execution when an asynchronous event (AsyncEvent) occurs.

If an event occurs multiple times, the releases of one event handler will be serialized, i.e., one event handler will never be released more than once simultaneously. However, one event that is attached to several handlers can cause the simultaneous release of several event handlers.

If the release parameters associated with this handler are SporadicParameters, then the minimum interarrival time specified in these parameters will be enforced.

The deadline specified is always relative to the fire time, even if the actual release time may be later to enforce the minimum interarrival time.

Handlers run in the context of a RealtimeThread, they may run for short or long times and they may block. Note that a handler that is blocked may block all other handlers with the same scheduling parameters since these handlers may share one instance of RealtimeThread. A handler may not call RealtimeThread.waitForNextPeriod().

Several handlers share a common set of RealtimeThreads for their execution. This causes some additional overhead when releasing a handler and it may cause a delayed execution if a handler with equal scheduling parameters is blocked during execution. To avoid these delays, handlers of class BoundAsyncEventHandler may be used, these handlers are bound to their own RealtimeThread for execution, but they require more system resources (threads and memory).

AsyncEventHandlers may make use of memory areas exactly as RealtimeThreads do.


Constructor Summary
AsyncEventHandler()
          Constructor to create an instance of AsyncEventHandler with default parameters.
AsyncEventHandler(boolean noheap)
          Constructor to create an instance of AsyncEventHandler with default parameters and the specified value for the noheap parameter.
AsyncEventHandler(boolean noheap, java.lang.Runnable logic)
          Constructor to create an instance of AsyncEventHandler with default parameters and the specified values for the noheap and logic parameters.
AsyncEventHandler(java.lang.Runnable logic)
          Constructor to create an instance of AsyncEventHandler with default parameters and the specified value for the logic parameter.
AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters group, boolean noheap)
          Constructor to create an instance of AsyncEventHandler with the given scheduling, release, memory, memory area, processing group, and noheap parameters.
AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters group, boolean noheap, java.lang.Runnable logic)
          Constructor to create an instance of AsyncEventHandler with the given scheduling, release, memory, memory area, processing group, noheap, and logic parameters.
AsyncEventHandler(SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters group, java.lang.Runnable logic)
          Constructor to create an instance of AsyncEventHandler with the given scheduling, release, memory, memory area, processing group, and logic parameters.
 
Method Summary
 boolean addIfFeasible()
           addIfFeasible adds this to the feasibility analysis of the associated scheduler if the resulting system will be feasible.
 boolean addToFeasibility()
           addToFeasibility notifies the scheduler associated with this that this schedulable object's scheduling, release, memory, and processing group parameters take part in the feasibility analysis.
 void finalize()
          finalizer to release and terminate execution thread that is not needed any longer.
protected  int getAndClearPendingFireCount()
          getAndClearPendingFireCount sets the pending fire count to zero and returns the original value.
protected  int getAndDecrementPendingFireCount()
          getAndDecrementPendingFireCount decrements the pending fire count and returns the original value.
protected  int getAndIncrementPendingFireCount()
          getAndIncrementPendingFireCount increments the pending fire count and returns the original value.
 MemoryArea getMemoryArea()
          getMemoryArea returns the initial memory area provided to the constructor of this handler.
 MemoryParameters getMemoryParameters()
          getMemoryParameters returns a reference to the MemoryParameters of this AsyncEventHandler.
protected  int getPendingFireCount()
          getPendingFireCount returns the current number of pending invocations to handleAsyncEvent().
 ProcessingGroupParameters getProcessingGroupParameters()
          getProcessingGroupParameters returns the current ProcessingGroupParameters of this AsyncEventHandler.
 ReleaseParameters getReleaseParameters()
          getReleaseParameters returns the current ReleaseParameters of this AsyncEventHandler.
 Scheduler getScheduler()
          getScheduler returns the current scheduler of this handler.
 SchedulingParameters getSchedulingParameters()
          getSchedulingParameters returns the SchedulingParameters of this handler.
 void handleAsyncEvent()
          handleAsyncEvent should be overwritten to contain the code to be executed whenever this event is released.
 boolean isDaemon()
          Check if this is a daemon handler, i.e., one that does not keep the VM from exiting.
 boolean removeFromFeasibility()
          removeFromFeasibility informs the scheduler associated with this AsyncEventHandler that this AsyncEventHandler should no longer be taken into account in the feasibility analysis.
 void run()
          run calls handleAsyncEvent repeatedly until the fire count reaches zero.
 void setDaemon(boolean on)
          Mark this handler as daemon or non-daemon.
 boolean setIfFeasible(ReleaseParameters release, MemoryParameters memory)
           setIfFeasible performs a feasibility analysis using the provided release and memory parameters.
 boolean setIfFeasible(ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group)
           setIfFeasible performs a feasibility analysis using the provided release, memory, and processing group parameters.
 boolean setIfFeasible(ReleaseParameters release, ProcessingGroupParameters group)
           setIfFeasible performs a feasibility analysis using the provided release and processing group parameters.
 boolean setIfFeasible(SchedulingParameters sched, ReleaseParameters release, MemoryParameters memory)
           setIfFeasible performs a feasibility analysis using the provided scheduling, release and memory parameters.
 boolean setIfFeasible(SchedulingParameters sched, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group)
           setIfFeasible performs a feasibility analysis using the provided scheduling, release, memory, and processing group parameters.
 void setMemoryParameters(MemoryParameters memory)
           setMemoryParameters replaces the memory parameters for this handler with the parameters provided.
 boolean setMemoryParametersIfFeasible(MemoryParameters memory)
           setMemoryParametersIfFeasible performs a feasibility analysis using the provided memory parameters.
 void setProcessingGroupParameters(ProcessingGroupParameters group)
           setProcessingGroupParameters sets the processing group parameters of this handler.
 boolean setProcessingGroupParametersIfFeasible(ProcessingGroupParameters group)
           setProcessingGroupParametersIfFeasible performs a feasibility analysis using the provided processing group parameters.
 void setReleaseParameters(ReleaseParameters release)
           setReleaseParameters replaces the release parameters for this handler with the parameters provided.
 boolean setReleaseParametersIfFeasible(ReleaseParameters release)
           setReleaseParametersIfFeasible performs a feasibility analysis using the provided release parameters.
 void setScheduler(Scheduler scheduler)
           setScheduler sets the scheduler for this handler.
 void setScheduler(Scheduler scheduler, SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group)
           setScheduler sets the scheduler and scheduling, release, memory, and processing group parameters for this handler.
 void setSchedulingParameters(SchedulingParameters scheduling)
           setSchedulingParameters sets the scheduling parameters for this handler.
 boolean setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
           setSchedulingParametersIfFeasible performs a feasibility analysis using the provided scheduling parameters.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncEventHandler

public AsyncEventHandler()
Constructor to create an instance of AsyncEventHandler with default parameters. This is short-hand for new AsyncEventHandler(null, null, null, null, null, false, null).


AsyncEventHandler

public AsyncEventHandler(java.lang.Runnable logic)
Constructor to create an instance of AsyncEventHandler with default parameters and the specified value for the logic parameter. This is short-hand for new AsyncEventHandler(null, null, null, null, null, false, logic).

Parameters:
logic - the logic to executed or null.

AsyncEventHandler

public AsyncEventHandler(SchedulingParameters scheduling,
                         ReleaseParameters release,
                         MemoryParameters memory,
                         MemoryArea area,
                         ProcessingGroupParameters group,
                         java.lang.Runnable logic)
Constructor to create an instance of AsyncEventHandler with the given scheduling, release, memory, memory area, processing group, and logic parameters. This is short-hand for new AsyncEventHandler(scheduling, release, memory, area, group, false, logic).

Parameters:
scheduling - SchedulingParameters to be associated with the new async event handler. This can be shared with several Schedulable objects. If it is null, a copy of the creator's value will be created in the same memory area as this AEH object. If it is null and the current thread is a normal Java thread, the scheduling parameters will be set to the default priority.
release - ReleaseParameters to be associated with the new async event handler. This can be shared with several Schedulable objects. If it is null, default release parameters will be used.
memory - MemoryParameters to be associated with the new thread. May be null for unrestricted amount and rate of memory allocation for the new AEH.
area - MemoryArea to be used by the new AEH. If it is null, the current memory area of the calling thread will be used.
group - ProcessingGroupParameters to be associated with this. This can be shared with several Schedulable objects. If it is null, this will not be associated with any processing group.

AsyncEventHandler

public AsyncEventHandler(boolean noheap)
Constructor to create an instance of AsyncEventHandler with default parameters and the specified value for the noheap parameter. This is short-hand for new AsyncEventHandler(null, null, null, null, null, noheap, null).

Parameters:
noheap - true to create an AsyncEventHandler that runs in a NoHeapRealtimeThread.
Throws:
java.lang.IllegalArgumentException - if noheap is true, -strictRTSJ is set and this was allocated in HeapMemory.

AsyncEventHandler

public AsyncEventHandler(boolean noheap,
                         java.lang.Runnable logic)
Constructor to create an instance of AsyncEventHandler with default parameters and the specified values for the noheap and logic parameters. This is short-hand for new AsyncEventHandler(null, null, null, null, null, noheap, logic).

Parameters:
noheap - true to create an AsyncEventHandler that runs in a NoHeapRealtimeThread.
logic - the logic to executed or null.
Throws:
java.lang.IllegalArgumentException - if noheap is true, -strictRTSJ is set and this or logic was allocated in HeapMemory.

AsyncEventHandler

public AsyncEventHandler(SchedulingParameters scheduling,
                         ReleaseParameters release,
                         MemoryParameters memory,
                         MemoryArea area,
                         ProcessingGroupParameters group,
                         boolean noheap)
Constructor to create an instance of AsyncEventHandler with the given scheduling, release, memory, memory area, processing group, and noheap parameters. This is short-hand for new AsyncEventHandler(scheduling, release, memory, area, group, noheap, null).

Parameters:
scheduling - SchedulingParameters to be associated with the new async event handler. This can be shared with several Schedulable objects. If it is null, a copy of the creator's value will be created in the same memory area as this AEH object. If it is null and the current thread is a normal Java thread, the scheduling parameters will be set to the default priority.
release - ReleaseParameters to be associated with the new AsyncEventHandler. This can be shared with several Schedulable objects. If it is null, default release parameters will be used.
memory - MemoryParameters to be associated with new thread. May be null for unrestricted amount and rate of memory allocation for the new AEH.
area - MemoryArea to be used by the new AEH. If it is null, the current memory area of the calling thread will be used.
group - ProcessingGroupParameters to be associated with this. This can be shared with several Schedulable objects. If it is null, this will not be associated with any processing group.
noheap - true to create an AsyncEventHandler that runs in a NoHeapRealtimeThread.
Throws:
java.lang.IllegalArgumentException - if noheap is true, -strictRTSJ is set and this, scheduling, release, memory, area, or group was allocated in HeapMemory.

AsyncEventHandler

public AsyncEventHandler(SchedulingParameters scheduling,
                         ReleaseParameters release,
                         MemoryParameters memory,
                         MemoryArea area,
                         ProcessingGroupParameters group,
                         boolean noheap,
                         java.lang.Runnable logic)
Constructor to create an instance of AsyncEventHandler with the given scheduling, release, memory, memory area, processing group, noheap, and logic parameters.

Parameters:
scheduling - SchedulingParameters to be associated with the new AsyncEventHandler. This can be shared with several Schedulable objects. If it is null, a copy of the creator's value will be created in the same memory area as this AEH object. If it is null and the current thread is a normal Java thread, the scheduling parameters will be set to the default priority.
release - ReleaseParameters to be associated with the new AsyncEventHandler. This can be shared with several Schedulable objects. If it is null, default release parameters will be used.
memory - MemoryParameters to be associated with the new thread. May be null for unrestricted amount and rate of memory allocation for the new AEH.
area - MemoryArea to be used by the new AEH. If it is null, the current memory area of the calling thread will be used.
group - ProcessingGroupParameters to be associated with this. This can be shared with several Schedulable objects. If it is null, this will not be associated with any processing group.
noheap - true to create an AsyncEventHandler that runs in a NoHeapRealtimeThread.
logic - Runnable to be used as the logic for this. If is is null, the run() method in this new AsyncEventHandler object will be called when the thread is started.
Throws:
java.lang.IllegalArgumentException - iff scheduling or release parameters are not compatible with the default scheduler, i.e., iff they are non-null and not an instance of PriorityParameters or PeriodicParameters, AperiodicParameters and SporadicParameters, respectively.
java.lang.IllegalArgumentException - if noheap is true, -strictRTSJ is set and this, scheduling, release, memory, area, or group was allocated in HeapMemory.
IllegalAssignmentError - if scheduling, release, memory, area, group, or logic reside in memory areas whose objects cannot be referred to by this or this object resides in a memory area that cannot be referenced by scheduling, release, or memory.
Method Detail

handleAsyncEvent

public void handleAsyncEvent()
handleAsyncEvent should be overwritten to contain the code to be executed whenever this event is released. The default implementation runs the logic given as an argument to the constructor. It performs no operation if no logic was provided.

This method will be called repeatedly while fireCount is greater than zero, the fireCount will be reduced by one after each call.

Any throwable thrown by this method will be caught, the stack trace will be printed and the exception will be ignored.


getPendingFireCount

protected int getPendingFireCount()
getPendingFireCount returns the current number of pending invocations to handleAsyncEvent(). During the execution of handleAsyncEvent(), the fireCount is at least 1 unless it has been reset manually (by a call to getAndClearPendingFireCount() or getAndDecrementPendingFireCount()).

Returns:
The current number of pending executions of handleAsyncEvent().

getAndClearPendingFireCount

protected int getAndClearPendingFireCount()
getAndClearPendingFireCount sets the pending fire count to zero and returns the original value.

Returns:
the original fire count.

getAndDecrementPendingFireCount

protected int getAndDecrementPendingFireCount()
getAndDecrementPendingFireCount decrements the pending fire count and returns the original value.

Returns:
the original fire count.

getAndIncrementPendingFireCount

protected int getAndIncrementPendingFireCount()
getAndIncrementPendingFireCount increments the pending fire count and returns the original value. Incrementing may result in a violation of the minimum inter-arrival time or in an overflow of the arrival time queue. In this case, the fire count will not be incremented.

Returns:
the original fire count.

isDaemon

public final boolean isDaemon()
Check if this is a daemon handler, i.e., one that does not keep the VM from exiting. By default, all newly created handlers are daemon handlers unless they are turned into non-daemon handlers explicitly by a call to setDaemon(false).

Returns:
true iff this is a daemon handler.
Since:
RTSJ V1.0.1

setDaemon

public final void setDaemon(boolean on)

Mark this handler as daemon or non-daemon. Non-Daemon event handlers prevent the VM from exiting as long as they run. This must be called before this handler is attached to an event, the state cannot be changed later.

By default, all newly created handlers are daemon handler unless they are turned into non-daemon handlers explicitly by a call to setDaemon(false).

Parameters:
on - true to select daemon state, false for non-daemon state.
Throws:
java.lang.IllegalThreadStateException - if this handler is attached to an async event.
java.lang.SecurityException - if this change is not allowed for the current schedulable object.
Since:
RTSJ V1.0.1

run

public final void run()
run calls handleAsyncEvent repeatedly until the fire count reaches zero. Subclasses cannot override this method, they should override handleAsyncEvent() instead.

Specified by:
run in interface java.lang.Runnable

getMemoryArea

public MemoryArea getMemoryArea()
getMemoryArea returns the initial memory area provided to the constructor of this handler. If none was provided, the default is the current allocation context when this was constructed.

Returns:
the initial memory area of this handler.

addToFeasibility

public boolean addToFeasibility()

addToFeasibility notifies the scheduler associated with this that this schedulable object's scheduling, release, memory, and processing group parameters take part in the feasibility analysis.

In case this schedulable object is already part of the feasibility analysis, do nothing.

Specified by:
addToFeasibility in interface Schedulable
Returns:
true iff the resulting system is feasible.

addIfFeasible

public boolean addIfFeasible()

addIfFeasible adds this to the feasibility analysis of the associated scheduler if the resulting system will be feasible.

If the object is already included in the feasible set, do nothing.

Specified by:
addIfFeasible in interface Schedulable
Returns:
true iff this was admitted to the feasible set. false if this was not admitted or if this was already part of the feasible set.

setIfFeasible

public boolean setIfFeasible(ReleaseParameters release,
                             MemoryParameters memory)
                      throws java.lang.IllegalArgumentException,
                             IllegalAssignmentError,
                             java.lang.IllegalThreadStateException

setIfFeasible performs a feasibility analysis using the provided release and memory parameters. If the system remains feasible with these new parameters, the parameters are replaced.

If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
release - the new release parameters. If null, the default value for the associated scheduler will be used.
memory - the new memory parameters. If null, the default value for the associated scheduler will be used.
Returns:
true iff the resulting system is feasible and the new release and memory parameters have been activated. false if the resulting system is not feasible, no changes are made in this case.
Throws:
java.lang.IllegalArgumentException - if the parameter values are not compatible with the scheduler associated to this AsyncEventHandler.
IllegalAssignmentError - if release or memory and this reside in memory areas whose objects cannot refer to one another (in both directions).
java.lang.IllegalThreadStateException - If the old release parameters are periodic, the new release parameters are not periodic, and the schedulable object is currently blocked in waitForNextPeriod or waitForNextPeriodInterruptible.

setIfFeasible

public boolean setIfFeasible(SchedulingParameters sched,
                             ReleaseParameters release,
                             MemoryParameters memory)
                      throws java.lang.IllegalArgumentException,
                             IllegalAssignmentError,
                             java.lang.IllegalThreadStateException

setIfFeasible performs a feasibility analysis using the provided scheduling, release and memory parameters. If the system remains feasible with these new parameters, the scheduling, release, and memory parameters are replaced.

If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
sched - the new scheduling parameters. If null, the default value of the associated scheduler will be used. This default value may be null.
release - the new release parameters. If null, the default value for the associated scheduler will be used.
memory - the new memory parameters. If null, the default value for the associated scheduler will be used.
Returns:
true iff the resulting system is feasible and the new release and memory parameters have been activated. false if the resulting system is not feasible, no changes are made in this case.
Throws:
java.lang.IllegalArgumentException - if the parameter values are not compatible with the scheduler associated to this AsyncEventHandler.
IllegalAssignmentError - if sched, release or memory and this reside in memory areas whose objects cannot refer to one another (in both directions).
java.lang.IllegalThreadStateException - If the old release parameters are periodic, the new release parameters are not periodic, and the schedulable object is currently blocked in waitForNextPeriod or waitForNextPeriodInterruptible.
Since:
RTSJ V1.0.1

setIfFeasible

public boolean setIfFeasible(ReleaseParameters release,
                             MemoryParameters memory,
                             ProcessingGroupParameters group)
                      throws java.lang.IllegalArgumentException,
                             IllegalAssignmentError,
                             java.lang.IllegalThreadStateException

setIfFeasible performs a feasibility analysis using the provided release, memory, and processing group parameters. If the system remains feasible with these new parameters, the parameters are replaced.

If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
release - the new release parameters. If null, the default value for the associated scheduler will be used.
memory - the new memory parameters. If null, the default value for the associated scheduler will be used.
group - the new processing group parameters. If null, the default value for the associated scheduler will be used.
Returns:
true iff the resulting system is feasible and the new release, memory, and group parameters have been activated. false if the resulting system is not feasible, no changes are made in this case.
Throws:
java.lang.IllegalArgumentException - if the parameter values are not compatible with the scheduler associated to this AsyncEventHandler.
IllegalAssignmentError - if release, memory or group and this reside in memory areas whose objects cannot refer to one another (in both directions).
java.lang.IllegalThreadStateException - If the old release parameters are periodic, the new release parameters are not periodic, and the schedulable object is currently blocked in waitForNextPeriod or waitForNextPeriodInterruptible.

setIfFeasible

public boolean setIfFeasible(SchedulingParameters sched,
                             ReleaseParameters release,
                             MemoryParameters memory,
                             ProcessingGroupParameters group)
                      throws java.lang.IllegalArgumentException,
                             IllegalAssignmentError,
                             java.lang.IllegalThreadStateException

setIfFeasible performs a feasibility analysis using the provided scheduling, release, memory, and processing group parameters. If the system remains feasible with these new parameters, the scheduling, release, memory, and processing group parameters are replaced.

If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
sched - the new scheduling parameters. If null, the default value of the associated scheduler will be used. This default value may be null.
release - the new release parameters. If null, the default value for the associated scheduler will be used.
memory - the new memory parameters. If null, the default value for the associated scheduler will be used.
group - the new processing group parameters. If null, the default value for the associated scheduler will be used.
Returns:
true iff the resulting system is feasible and the new scheduling, release, memory, and group parameters have been activated. false if the resulting system is not feasible, no changes are made in this case.
Throws:
java.lang.IllegalArgumentException - if the parameter values are not compatible with the scheduler associated to this AsyncEventHandler.
IllegalAssignmentError - if sched, release, memory or group and this reside in memory areas whose objects cannot refer to one another (in both directions).
java.lang.IllegalThreadStateException - If the old release parameters are periodic, the new release parameters are not periodic, and the schedulable object is currently blocked in waitForNextPeriod or waitForNextPeriodInterruptible.

setReleaseParametersIfFeasible

public boolean setReleaseParametersIfFeasible(ReleaseParameters release)
                                       throws java.lang.IllegalThreadStateException

setReleaseParametersIfFeasible performs a feasibility analysis using the provided release parameters. If the system remains feasible with the new parameters, the parameters are replaced.

If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.

Specified by:
setReleaseParametersIfFeasible in interface Schedulable
Parameters:
release - the new release parameters. If null, the default value for the associated scheduler will be used.
Returns:
true iff the resulting system is feasible and the new release parameters have been activated. false if the resulting system is not feasible, no changes are made in this case.
Throws:
java.lang.IllegalArgumentException - if the parameter values are not compatible with the scheduler associated to this AsyncEventHandler.
IllegalAssignmentError - if release and this reside in memory areas whose objects cannot refer to one another (in both directions).
java.lang.IllegalThreadStateException - If the old release parameters are periodic, the new release parameters are not periodic, and the schedulable object is currently blocked in waitForNextPeriod or waitForNextPeriodInterruptible.

setProcessingGroupParametersIfFeasible

public boolean setProcessingGroupParametersIfFeasible(ProcessingGroupParameters group)

setProcessingGroupParametersIfFeasible performs a feasibility analysis using the provided processing group parameters. If the system remains feasible with these new parameters, parameters are replaced.

If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.

Specified by:
setProcessingGroupParametersIfFeasible in interface Schedulable
Parameters:
group - the new processing group parameters. If null, the default value for the associated scheduler will be used.
Returns:
true iff the resulting system is feasible and the new group parameters have been activated. false if the resulting system is not feasible, no changes are made in this case.
Throws:
java.lang.IllegalArgumentException - if the group parameter value is not compatible with the scheduler associated to this AsyncEventHandler.
IllegalAssignmentError - If group and this reside in memory areas whose objects cannot refer to one another (in both directions).

setIfFeasible

public boolean setIfFeasible(ReleaseParameters release,
                             ProcessingGroupParameters group)
                      throws java.lang.IllegalArgumentException,
                             IllegalAssignmentError,
                             java.lang.IllegalThreadStateException

setIfFeasible performs a feasibility analysis using the provided release and processing group parameters. If the system remains feasible with these new parameters, the parameters are replaced.

If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
release - the new release parameters. If null, the default value for the associated scheduler will be used.
group - the new processing group parameters. If null, the default value for the associated scheduler will be used.
Returns:
true iff the resulting system is feasible and the new release and group parameters have been activated. false if the resulting system is not feasible, no changes are made in this case.
Throws:
java.lang.IllegalArgumentException - if the parameter values are not compatible with the scheduler associated to this AsyncEventHandler.
IllegalAssignmentError - if release or group and this reside in memory areas whose objects cannot refer to one another (in both directions).
java.lang.IllegalThreadStateException - If the old release parameters are periodic, the new release parameters are not periodic, and the schedulable object is currently blocked in waitForNextPeriod or waitForNextPeriodInterruptible.

setMemoryParametersIfFeasible

public boolean setMemoryParametersIfFeasible(MemoryParameters memory)

setMemoryParametersIfFeasible performs a feasibility analysis using the provided memory parameters. If the system remains feasible with the new memory parameters, the parameters are replaced.

In JamaicaVM, this change becomes effective immediately.

If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.

Specified by:
setMemoryParametersIfFeasible in interface Schedulable
Parameters:
memory - the new memory parameters. If null, the default value for the associated scheduler will be used.
Returns:
true iff the resulting system is feasible and the new release, memory, and group parameters have been activated. false if the resulting system is not feasible, no changes are made in this case.
Throws:
java.lang.IllegalArgumentException - if the memory parameter value is not compatible with the scheduler associated to this AsyncEventHandler.
IllegalAssignmentError - if memory and this reside in memory areas whose objects cannot refer to one another (in both directions).

getMemoryParameters

public MemoryParameters getMemoryParameters()
getMemoryParameters returns a reference to the MemoryParameters of this AsyncEventHandler.

Specified by:
getMemoryParameters in interface Schedulable
Returns:
the MemoryParameters of this AsyncEventHandler.

getReleaseParameters

public ReleaseParameters getReleaseParameters()
getReleaseParameters returns the current ReleaseParameters of this AsyncEventHandler.

Specified by:
getReleaseParameters in interface Schedulable
Returns:
the ReleaseParameters.

getScheduler

public Scheduler getScheduler()
getScheduler returns the current scheduler of this handler.

Specified by:
getScheduler in interface Schedulable
Returns:
the scheduler.

getSchedulingParameters

public SchedulingParameters getSchedulingParameters()
getSchedulingParameters returns the SchedulingParameters of this handler.

Specified by:
getSchedulingParameters in interface Schedulable
Returns:
the SchedulingParameters.

getProcessingGroupParameters

public ProcessingGroupParameters getProcessingGroupParameters()
getProcessingGroupParameters returns the current ProcessingGroupParameters of this AsyncEventHandler.

Specified by:
getProcessingGroupParameters in interface Schedulable
Returns:
the ProcessingGroupParameters

removeFromFeasibility

public boolean removeFromFeasibility()
removeFromFeasibility informs the scheduler associated with this AsyncEventHandler that this AsyncEventHandler should no longer be taken into account in the feasibility analysis.

Specified by:
removeFromFeasibility in interface Schedulable
Returns:
true iff this could be removed successfully, false iff this was not part of the feasible set of the assigned scheduler.

setMemoryParameters

public void setMemoryParameters(MemoryParameters memory)
                         throws java.lang.IllegalThreadStateException

setMemoryParameters replaces the memory parameters for this handler with the parameters provided.

This change may change the feasibility of the current feasible set of this handler's scheduler.

In JamaicaVM, this change becomes effective at the next release of the handler.

Specified by:
setMemoryParameters in interface Schedulable
Parameters:
memory - the new memory parameters. If null, the default value for the associated scheduler will be used.
Throws:
java.lang.IllegalArgumentException - if the memory parameter value is not compatible with the scheduler associated to this AsyncEventHandler.
IllegalAssignmentError - if memory and this reside in memory areas whose objects cannot refer to one another (in both directions).
java.lang.IllegalThreadStateException

setReleaseParameters

public void setReleaseParameters(ReleaseParameters release)
                          throws java.lang.IllegalThreadStateException

setReleaseParameters replaces the release parameters for this handler with the parameters provided.

This change may change the feasibility of the current feasible set of this handler's scheduler.

Specified by:
setReleaseParameters in interface Schedulable
Parameters:
release - the new release parameters. If null, the default value for the associated scheduler will be used.
Throws:
java.lang.IllegalArgumentException - if the release parameter value is not compatible with the scheduler associated to this AsyncEventHandler.
IllegalAssignmentError - if release and this reside in memory areas whose objects cannot refer to one another (in both directions).
java.lang.IllegalThreadStateException - If the old release parameters are periodic, the new release parameters are not periodic, and the schedulable object is currently blocked in waitForNextPeriod or waitForNextPeriodInterruptible.

setScheduler

public void setScheduler(Scheduler scheduler,
                         SchedulingParameters scheduling,
                         ReleaseParameters release,
                         MemoryParameters memory,
                         ProcessingGroupParameters group)
                  throws java.lang.IllegalArgumentException,
                         IllegalAssignmentError,
                         java.lang.IllegalThreadStateException,
                         java.lang.SecurityException

setScheduler sets the scheduler and scheduling, release, memory, and processing group parameters for this handler.

The change of the scheduler and the scheduling and memory parameters will be immediate for the default scheduler. release, and processing group parameters will take effect on the next release.

This change may change the feasibility of the current feasible set of this handler's scheduler.

Specified by:
setScheduler in interface Schedulable
Parameters:
scheduler - The scheduler to be used for this handler. Must not be null.
scheduling - SchedulingParameters to be associated with the handler. If null, the default value of the scheduler will be used.
release - the new release parameters. If null, the default value for the associated scheduler will be used.
memory - the new memory parameters. If null, the default value for the associated scheduler will be used.
group - the new processing group parameters to be applied for the next release of this. If null, the default value for the scheduler will be used.
Throws:
java.lang.IllegalArgumentException - if scheduler is null or the scheduling, release, memory, or processing group parameters are not compatible with the scheduler.
IllegalAssignmentError - if scheduler, scheduling, release, memory, or group reside in memory areas whose objects cannot be referred to by this or this object resides in a memory area that cannot be referenced by scheduling, release, or memory.
java.lang.IllegalThreadStateException - If the old release parameters are periodic, the new release parameters are not periodic and the schedulable object is currently blocked in waitForNextPeriod or waitForNextPeriodInterruptible.
java.lang.SecurityException - if setting of the scheduler is not allowed by the current RealtimeSystem setting.

setScheduler

public void setScheduler(Scheduler scheduler)
                  throws java.lang.IllegalArgumentException,
                         IllegalAssignmentError,
                         java.lang.SecurityException

setScheduler sets the scheduler for this handler. If this has been admitted to the feasible set, it remains in the feasible set.

This change may change the feasibility of the current feasible set of this handler's scheduler.

Specified by:
setScheduler in interface Schedulable
Parameters:
scheduler - the new scheduler to be used. Must not be null.
Throws:
java.lang.IllegalArgumentException - iff the scheduler is null or the current parameters of this are not compatible with the new scheduler.
IllegalAssignmentError - if scheduler and this reside in memory areas whose objects cannot refer to one another (in both directions).
java.lang.SecurityException - if setting of the scheduler is not allowed by the current RealtimeSystem setting.

setSchedulingParameters

public void setSchedulingParameters(SchedulingParameters scheduling)
                             throws java.lang.IllegalThreadStateException

setSchedulingParameters sets the scheduling parameters for this handler.

In JamaicaVM, this change of the scheduling parameters becomes effective at the next release for the default PriorityScheduler.

Specified by:
setSchedulingParameters in interface Schedulable
Parameters:
scheduling - the new scheduling parameters.
Throws:
java.lang.IllegalArgumentException - iff scheduling is not compatible with the scheduler.
IllegalAssignmentError - if scheduling and this reside in memory areas whose objects cannot refer to one another (in both directions).
java.lang.IllegalThreadStateException

setProcessingGroupParameters

public void setProcessingGroupParameters(ProcessingGroupParameters group)

setProcessingGroupParameters sets the processing group parameters of this handler.

In JamaicaVM, this change becomes effective immediately.

This change may change the feasibility of the current feasible set of this AsyncEventHandler's scheduler.

Specified by:
setProcessingGroupParameters in interface Schedulable
Parameters:
group - the new processing group parameters to be applied for the next release of this. If null, use the default value for the scheduler.
Throws:
java.lang.IllegalArgumentException - if the group argument is not compatible with the scheduler of this RealtimeThread.

setSchedulingParametersIfFeasible

public boolean setSchedulingParametersIfFeasible(SchedulingParameters scheduling)

setSchedulingParametersIfFeasible performs a feasibility analysis using the provided scheduling parameters. If the system remains feasible with these new parameters, the scheduling parameters are replaced.

In JamaicaVM, this change of the scheduling parameters becomes effective immediately for the default PriorityScheduler.

If this object is not a member of the feasible set of the scheduler and the resulting system is feasible, this will be added to the set.

Specified by:
setSchedulingParametersIfFeasible in interface Schedulable
Parameters:
scheduling - the new scheduling parameters. If null, the default value of the associated scheduler will be used. This default value may be null.
Returns:
true iff the resulting system is feasible and the new scheduling parameters have been activated. false if the resulting system is not feasible, no changes are made in this case.
Throws:
java.lang.IllegalArgumentException - if the parameter values are not compatible with the scheduler associated to this AsyncEventHandler.
IllegalAssignmentError - if sched, release, memory or group and this reside in memory areas whose objects cannot refer to one another (in both directions).

finalize

public void finalize()
finalizer to release and terminate execution thread that is not needed any longer.

Overrides:
finalize in class java.lang.Object

aicas logoJamaica 6.1 release 1

aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2012 aicas GmbH. All Rights Reserved.