public class AsynchronouslyInterruptedException extends InterruptedException implements StaticThrowable<AsynchronouslyInterruptedException>
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.
StaticThrowable.Hidden
Constructor and Description |
---|
AsynchronouslyInterruptedException()
Constructor to create an instance of
AsynchronouslyInterruptedException.
|
Modifier and Type | Method and Description |
---|---|
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().
|
AsynchronouslyInterruptedException |
getSingleton()
For the case of legacy code that creates an RTSJ exception
explicity, this provides a means of obtaining its singleton version.
|
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.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, init, init, init, init, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, writeReplace
public AsynchronouslyInterruptedException()
public AsynchronouslyInterruptedException getSingleton()
StaticThrowable
getSingleton
in interface StaticThrowable<AsynchronouslyInterruptedException>
public static AsynchronouslyInterruptedException getGeneric()
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.
public boolean disable()
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.
public boolean isEnabled()
public boolean fire()
public boolean doInterruptible(Interruptible logic)
StaticIllegalArgumentException
- iff the provided logic parameter
is null.logic
- Contains the run() method that specifies the logic
to be executed in an interruptible way.public boolean happened(boolean propagate)
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.
propagate
- true to immediately throw a pending AIE
different to this.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.
IllegalThreadStateException
public static void propagate()
aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2019 aicas GmbH. All Rights Reserved.