public class AsynchronouslyInterruptedException extends InterruptedException implements StaticThrowable<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.
|
AsynchronouslyInterruptedException(String message)
Creates 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 |
isEnabled()
isEnabled returns the current state of this AIE: enabled or
disabled.
|
static void |
throwPending()
Causes a pending
AsynchronouslyInterruptedException to be
thrown as a synchronous exception in an AI-deferred region if one
exists. |
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, isStatic, printStackTrace, printStackTrace, printStackTrace, setStackTrace, writeReplace
public AsynchronouslyInterruptedException()
public AsynchronouslyInterruptedException(String message)
AsynchronouslyInterruptedException
.message
- A message to identify this instance.public static AsynchronouslyInterruptedException getGeneric()
public AsynchronouslyInterruptedException getSingleton()
StaticThrowable
getSingleton
in interface StaticThrowable<AsynchronouslyInterruptedException>
public boolean enable()
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 clear() throws IllegalThreadStateException
IllegalThreadStateException
public static void throwPending() throws AsynchronouslyInterruptedException
AsynchronouslyInterruptedException
to be
thrown as a synchronous exception in an AI-deferred region if one
exists.AsynchronouslyInterruptedException
- when an AIE is pending.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2021 aicas GmbH. All Rights Reserved.