aicas logoJamaica 6.4 release 1

javax.realtime
Class AsynchronouslyInterruptedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.InterruptedException
              extended by javax.realtime.AsynchronouslyInterruptedException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Timed

public class AsynchronouslyInterruptedException
extends InterruptedException

Jamaica Real-Time Specification for Java class AsynchronouslyInterruptedException.

This class is used to identify methods that should be asynchronously interruptible. Any methods that lists AsynchronouslyInterruptedException or any subclass of this class in its throws clause will be asynchronously interruptible. Within such a method, only code sequences that are enclosed by a synchronized() block are not asynchronously interruptible. However, calls to asynchronously interruptible methods that are performed within a synchronized block are, again, interruptible.

The asynchronous interrupt is generated by either a call to t.interrupt() for a RealtimeThread t or by a call to fire() for a schedulable object that currently performs code within a call to doInterruptible().

An asynchronous interrupt that is caused while the target schedulable object executes code that is not interruptible (a method that does not throw AsynchronouslyInterruptedException or a synchronized() block), the interrupt remains pending until this code enters an interruptible code section.

An AsynchronouslyInterruptedException may be caught, and it may be cleared by a call to clear(). However, propagation of an outer AsynchronouslyInterruptedException may not be stopped by a call to clear.

See Also:
Serialized Form

Constructor Summary
AsynchronouslyInterruptedException()
          Constructor to create an instance of AsynchronouslyInterruptedException.
 
Method Summary
 boolean clear()
           clear checks if it is called on the AIE that is currently pending.
 boolean disable()
          disable interruption by this exception.
 boolean doInterruptible(Interruptible logic)
          doInterruptible executes the run() method of the provided Interruptible.
 boolean enable()
           enable interruption by this exception.
 boolean fire()
          fire this exception during the execution of a doInterruptible() section.
static AsynchronouslyInterruptedException getGeneric()
          getGeneric returns the generic instance of AsynchronouslyInterruptedException that is thrown on a call to RealtimeThread.interrupt().
 boolean happened(boolean propagate)
          Deprecated. RTSJ V1.0.1 use clear() instead.
 boolean isEnabled()
          isEnabled returns the current state of this AIE: enabled or disabled.
static void propagate()
          Deprecated. RTSJ V1.0.1 throw this exception normally.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AsynchronouslyInterruptedException

public AsynchronouslyInterruptedException()
Constructor to create an instance of AsynchronouslyInterruptedException.

Method Detail

getGeneric

public static AsynchronouslyInterruptedException getGeneric()
getGeneric returns the generic instance of AsynchronouslyInterruptedException that is thrown on a call to RealtimeThread.interrupt().

Returns:
the generic instance of AsynchronouslyInterruptedException.

enable

public boolean enable()

enable interruption by this exception. This can be used during the execution of a doInterruptible() section to control interruption by this exception.

If called from an environment that is not currently executing a doInterruptible() section for this exception, this returns false.

If an interruption with this exception occurred during the time this was disabled, a fire() will occur at the point this is re-enabled.

Returns:
true if this was disabled before the call and is enabled now. False if it was already enabled or it could not be enabled because this method was not called from an environment that is executing a doInterruptible() section for this exception.

disable

public boolean disable()
disable interruption by this exception. This can be used during the execution of a doInterruptible section to control interruption by this exception.

If called from an environment that is not currently executing a doInterruptible() section for this exception, this returns false.

If an interruption with this exception occurred during the time this was disabled, a fire() will occur at the point this is re-enabled.

Returns:
true if this was enabled before the call and is disabled now. False if it was already disabled or it could not be enabled because this method was not called from an environment that is executing a doInterruptible() section for this exception.

isEnabled

public boolean isEnabled()
isEnabled returns the current state of this AIE: enabled or disabled.

Returns:
true iff this AIE is enabled.

fire

public boolean fire()
fire this exception during the execution of a doInterruptible() section. This becomes the current AsynchronouslyInterruptedException if the current schedulable object is not interrupted or it is interrupted by an AsynchronouslyInterruptedException with a deeper nesting level than this.

Returns:
true iff this is enabled, a doInterruptible is in progress and the current schedulable object is not interrupted by an AsynchronouslyInterruptedException with a shallower nesting level.

doInterruptible

public boolean doInterruptible(Interruptible logic)
doInterruptible executes the run() method of the provided Interruptible. The execution of this run() method will be interruptible by this exception.

Parameters:
logic - Contains the run() method that specifies the logic to be executed in an interruptible way.
Returns:
false iff this call failed since this AIE is currently running a call to doInterruptible for the current or a different thread.
Throws:
IllegalArgumentException - iff the provided logic parameter is null.

happened

public boolean happened(boolean propagate)
Deprecated. RTSJ V1.0.1 use clear() instead.

happened checks if it is called on the AIE that is currently pending. If this is the case, this pending exception is cleared and true is returned.

If the currently pending exception is not this, and propagate is true, the pending AIE will be propagated outward (thrown), even though it is not listed in the throws clause of this method.

If the currently pending exception is not this, and propagate is false, false will be returned and the pending AIE will remain pending.

Parameters:
propagate - true to immediately throw a pending AIE different to this.
Returns:
true if this is equal to the currently pending AIE, false if it is not.

clear

public boolean clear()
              throws IllegalThreadStateException

clear checks if it is called on the AIE that is currently pending. If this is the case, this pending exception is cleared and true is returned.

Returns:
true if this is equal to the currently pending AIE, false if it is not.
Throws:
IllegalThreadStateException
Since:
RTSJ V1.0.1

propagate

public static void propagate()
Deprecated. RTSJ V1.0.1 throw this exception normally.

propagate throws the currently pending AIE. Control continues at the next catch clause that catches this AIE.


aicas logoJamaica 6.4 release 1

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