public class AsynchronouslyInterruptedException extends java.lang.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(java.lang.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.
|
java.lang.Throwable |
fillInStackTrace()
Calls into the virtual machine to capture the current stack trace
in task's local memory.
|
boolean |
fire()
fire this exception during the execution of a doInterruptible()
section.
|
static AsynchronouslyInterruptedException |
get()
Gets the preallocated version of this
Throwable . |
java.lang.Throwable |
getCause()
getCause returns the cause of this exception or
null when no cause
was set. |
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.
|
java.lang.StackTraceElement[] |
getStackTrace()
Get the stack trace created by fillInStackTrace for this Throwable as an
array of StackTraceElements.
|
java.lang.Throwable |
initCause(java.lang.Throwable causingThrowable)
Initializes the cause to the given Throwable is task's local memory.
|
boolean |
isEnabled()
isEnabled returns the current state of this AIE: enabled or
disabled.
|
void |
printStackTrace()
Print stack trace of this Throwable to System.err.
|
void |
printStackTrace(java.io.PrintStream stream)
Print the stack trace of this Throwable to the given stream.
|
void |
printStackTrace(java.io.PrintWriter writer)
Print the stack trace of this Throwable to the given PrintWriter.
|
void |
setStackTrace(java.lang.StackTraceElement[] new_stackTrace)
This method allows overriding the stack trace that was filled during
construction of this object.
|
static void |
throwPending()
Causes a pending
AsynchronouslyInterruptedException to be
thrown as a synchronous exception in an AI-deferred region if one
exists. |
addSuppressed, getLocalizedMessage, getMessage, getSuppressed, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getLocalizedMessage, getMessage, init, init, init, init, isStatic, writeReplace
public AsynchronouslyInterruptedException()
public AsynchronouslyInterruptedException(java.lang.String message)
AsynchronouslyInterruptedException
.message
- A message to identify this instance.public static AsynchronouslyInterruptedException get()
Throwable
. Allocation is
done in memory that acts like ImmortalMemory
. The message and
cause are cleared and the stack trace is filled out.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)
logic
- Contains the run() method that specifies the logic
to be executed in an interruptible way.StaticIllegalArgumentException
- iff the provided logic parameter
is null.public boolean clear() throws java.lang.IllegalThreadStateException
java.lang.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.public java.lang.Throwable initCause(java.lang.Throwable causingThrowable)
StaticThrowable
initCause
in interface StaticThrowable<AsynchronouslyInterruptedException>
initCause
in class java.lang.Throwable
causingThrowable
- the reason why this Throwable gets Thrown.public java.lang.Throwable getCause()
StaticThrowable
null
when no cause
was set. The cause is another exception that was caught before this
exception was created.getCause
in interface StaticThrowable<AsynchronouslyInterruptedException>
getCause
in class java.lang.Throwable
null
.public java.lang.Throwable fillInStackTrace()
StaticThrowable
fillInStackTrace
in interface StaticThrowable<AsynchronouslyInterruptedException>
fillInStackTrace
in class java.lang.Throwable
Throwable
.public void setStackTrace(java.lang.StackTraceElement[] new_stackTrace) throws java.lang.NullPointerException
StaticThrowable
setStackTrace
in interface StaticThrowable<AsynchronouslyInterruptedException>
setStackTrace
in class java.lang.Throwable
new_stackTrace
- the stack trace to replace be used.java.lang.NullPointerException
- when new_stackTrace or any element of
new_stackTrace is null
.public java.lang.StackTraceElement[] getStackTrace()
StaticThrowable
The stack trace does not need to contain entries for all methods that are actually on the call stack, the virtual machine may decide to skip some stack trace entries. Even an empty array is a valid result of this function.
Repeated calls of this function without intervening calls to fillInStackTrace will return the same result.
When memory areas of the RTSJ are used (see MemoryArea
), and this
Throwable was allocated in a different memory area than the current
allocation context, the resulting stack trace will be allocated in either
the same memory area this was allocated in or the current memory area,
depending on which is the least deeply nested, thereby creating objects
that are assignment compatible with both areas.
getStackTrace
in interface StaticThrowable<AsynchronouslyInterruptedException>
getStackTrace
in class java.lang.Throwable
null
.public void printStackTrace()
StaticThrowable
The printed stack trace contains the result of toString() as the first line followed by one line for each stack trace element that contains the name of the method or constructor, optionally followed by the source file name and source file line number when available.
printStackTrace
in interface StaticThrowable<AsynchronouslyInterruptedException>
printStackTrace
in class java.lang.Throwable
public void printStackTrace(java.io.PrintStream stream)
StaticThrowable
The printed stack trace contains the result of toString() as the first line followed by one line for each stack trace element that contains the name of the method or constructor, optionally followed by the source file name and source file line number when available.
printStackTrace
in interface StaticThrowable<AsynchronouslyInterruptedException>
printStackTrace
in class java.lang.Throwable
stream
- the stream to print to.public void printStackTrace(java.io.PrintWriter writer)
StaticThrowable
The printed stack trace contains the result of toString() as the first line followed by one line for each stack trace element that contains the name of the method or constructor, optionally followed by the source file name and source file line number when available.
printStackTrace
in interface StaticThrowable<AsynchronouslyInterruptedException>
printStackTrace
in class java.lang.Throwable
writer
- the PrintWriter to write to.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2022 aicas GmbH. All Rights Reserved.