javax.realtime.control@Deprecated public class AsynchronouslyInterruptedException extends AsynchronouslyInterruptedException
A Schedulable that is executing a method or constructor,
which is declared with an AsynchronouslyInterruptedException
in its throws clause, can be asynchronously interrupted
except when it is executing in the lexical scope of a synchronized
statement within that method/constructor. As soon as the Schedulable
object leaves the lexical scope of the method by calling another
method/constructor it may be asynchronously interrupted when the called
method/constructor is asynchronously interruptible. (See this
chapter's introduction section for the detailed semantics).
The asynchronous interrupt is generated for a Schedulable,
s, when the s.interrupt() method is called
or the fire() method is called of an AIE for which s
has a doInterruptible method call in progress.
When an asynchronous interrupt is generated when the target
Schedulable is executing within an
ATC-deferred section, the asynchronous interrupt becomes pending. A
pending asynchronous interrupt is delivered when the target
Schedulable next attempts to enter asynchronously interruptible code.
Asynchronous transfers of control (ATCs) are intended to allow
long-running computations to be terminated without the overhead or
latency of polling with java.lang.Thread.interrupted().
When RealtimeThread.interrupt(), or
AsynchronouslyInterruptedException.fire() is called, the
AsynchronouslyInterruptedException is compared against
any currently pending AsynchronouslyInterruptedException
on the Schedulable. When there is none, or when the depth of the
AsynchronouslyInterruptedException is less than the
currently pending AsynchronouslyInterruptedException;
(i.e., it is targeted at a less deeply nested method call), the new
AsynchronouslyInterruptedException becomes the currently
pending AsynchronouslyInterruptedException and the
previously pending AsynchronouslyInterruptedException is
discarded. Otherwise, the new
AsynchronouslyInterruptedException is discarded.
When an AsynchronouslyInterruptedException is
caught, the catch clause may invoke the clear() method
on the AsynchronouslyInterruptedException in which it is
interested to see if the exception matches the pending
AsynchronouslyInterruptedException. When so, the pending
AsynchronouslyInterruptedException is cleared for the
Schedulable and clear returns true. Otherwise,
the current AIE remains pending and clear returns false.
RealtimeThread.interrupt() generates the
generic AsynchronouslyInterruptedException which will
always propagate outward through interruptible methods until the
generic AsynchronouslyInterruptedException is identified
and handled. The pending state of the generic AIE is per-instance of
Schedulable.
Other sources (e.g.,
AsynchronouslyInterruptedException.fire() and
Timed) will generate specific instances of
AsynchronouslyInterruptedException which applications
can identify and thus limit propagation.
StaticThrowable.Hidden| Constructor and Description |
|---|
AsynchronouslyInterruptedException()
Deprecated.
Creates an instance of
AsynchronouslyInterruptedException. |
AsynchronouslyInterruptedException(java.lang.String message)
Deprecated.
Creates an instance of
AsynchronouslyInterruptedException. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
clear()
Deprecated.
Atomically checks whether or not
this is pending on the
currently executing schedulable, and when so, makes it
non-pending. |
boolean |
disable()
Deprecated.
Disables the throwing of this exception.
|
boolean |
doInterruptible(Interruptible logic)
Deprecated.
Executes the
run() method of the given Interruptible. |
boolean |
enable()
Deprecated.
Enables the throwing of this exception.
|
java.lang.Throwable |
fillInStackTrace()
Deprecated.
Does nothing, since no stacktrace is kept.
|
boolean |
fire()
Deprecated.
Generates this exception when its
doInterruptible has been
invoked and not completed. |
static AsynchronouslyInterruptedException |
get()
Deprecated.
Gets the preallocated version of this
Throwable. |
static AsynchronouslyInterruptedException |
getGeneric()
Deprecated.
Gets the singleton system generic
AsynchronouslyInterruptedException that is generated when
RealtimeThread.interrupt() is invoked. |
java.lang.StackTraceElement[] |
getStackTrace()
Deprecated.
No stacktrace is kept, so none can be returned.
|
boolean |
happened(boolean propagate)
Deprecated.
|
boolean |
isEnabled()
Deprecated.
Queries the enabled status of this exception.
|
void |
printStackTrace()
Deprecated.
No stacktrace is kept, so a message to that effect is printed.
|
void |
printStackTrace(java.io.PrintStream stream)
Deprecated.
No stacktrace is kept, so a message to that effect is printed.
|
void |
printStackTrace(java.io.PrintWriter writer)
Deprecated.
No stacktrace is kept, so a message to that effect is printed.
|
void |
setStackTrace(java.lang.StackTraceElement[] new_stackTrace)
Deprecated.
Does nothing, since no stacktrace is kept.
|
doInterruptible, getSingleton, throwPendingaddSuppressed, getCause, getLocalizedMessage, getMessage, getSuppressed, initCause, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCause, getLocalizedMessage, getMessage, init, init, init, init, initCause, isStatic, writeReplacepublic AsynchronouslyInterruptedException()
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() throws IllegalTaskStateException
AsynchronouslyInterruptedException that is generated when
RealtimeThread.interrupt() is invoked.AsynchronouslyInterruptedException.IllegalTaskStateException - when the current thread context
is not an instance of Schedulable.public boolean enable()
doInterruptible in
progress. When invoked when no call to doInterruptible
is in progress, enable returns false and does nothing.enable in class AsynchronouslyInterruptedExceptiontrue, when this was disabled before the method
was called and the call was invoked whilst the associated
doInterruptible was in progress, and false
otherwise.public boolean disable()
fire()
method is called on this AIE whilst it is disabled,
the fire is held pending and delivered as soon as the AIE is
enabled and the interruptible code is within an AI-method. When an
AIE is pending when the associated disable method is called, the
AIE remains pending, and is delivered as soon as the AIE is enabled
and the interruptible code is within an AI-method.
This method is valid only when the caller has a call to
doInterruptible in progress. If invoked when no call
to doInterruptible is in progress,
disable returns false and does nothing.
disable in class AsynchronouslyInterruptedExceptiontrue, when this was enabled before the method was
called and the call was invoked with the associated
doInterruptible in progress, and
false otherwise.public boolean isEnabled()
This method is valid only when the caller has a call to
doInterruptible in progress. If invoked when no call to
doInterruptible is in progress, enable returns
false and does nothing.
isEnabled in class AsynchronouslyInterruptedExceptiontrue, when this is enabled and the method call was invoked
in the context of the associated doInterruptible, and
false otherwise.public boolean fire()
doInterruptible has been
invoked and not completed.
When this is the only outstanding AIE on the schedulable
object that invoked this AIE's doInterruptible(Interruptible)
method, this AIE becomes that schedulable's current AIE.
Otherwise, it only becomes the current AIE when it is at a less
deep level of nesting compared with the current outstanding AIE.
Behaves as if Thread.interrupt() were called on the task
currently operating within this exception's doInterruptible.
fire in class AsynchronouslyInterruptedExceptiontrue, when this is not disabled and it has
an invocation
of a doInterruptible in progress and there is no
outstanding fire request, and false otherwise.public boolean doInterruptible(Interruptible logic)
run() method of the given Interruptible.
This method may be on the stack in exactly one Schedulable
object. An attempt to invoke this method in a schedulable while it
is on the stack of another or the same schedulable will cause an
immediate return with a value of false.
The run() method of the given Interruptible is always
entered with the exception in the enabled state, but that state can be
modified with enable() and disable(), and the
state can be observed with isEnabled().
This AIE is cleared on return from doInterruptible.
logic - An instance of an Interruptible whose run()
method will be called.true, when the method call completed normally, and
false, when another call to doInterruptible
has not completed.IllegalTaskStateException - when called on the generic
AsynchronouslyInterruptedException.StaticIllegalArgumentException - when logic is
null.@Deprecated public boolean happened(boolean propagate)
public boolean clear()
this is pending on the
currently executing schedulable, and when so, makes it
non-pending.
This method may be called at any time, and in particular need not
be called in a try or catch block.
clear in class AsynchronouslyInterruptedExceptiontrue, when this was pending, and
false, when this was not pending.Schedulable.public java.lang.Throwable fillInStackTrace()
fillInStackTrace in interface StaticThrowable<AsynchronouslyInterruptedException>fillInStackTrace in class AsynchronouslyInterruptedExceptionthis instance.public void setStackTrace(java.lang.StackTraceElement[] new_stackTrace)
throws java.lang.NullPointerException
setStackTrace in interface StaticThrowable<AsynchronouslyInterruptedException>setStackTrace in class AsynchronouslyInterruptedExceptionnew_stackTrace - the stack trace to be used as replace.java.lang.NullPointerException - when new_stackTrace or any element of
new_stackTrace is null.public java.lang.StackTraceElement[] getStackTrace()
getStackTrace in interface StaticThrowable<AsynchronouslyInterruptedException>getStackTrace in class AsynchronouslyInterruptedExceptionpublic void printStackTrace()
printStackTrace in interface StaticThrowable<AsynchronouslyInterruptedException>printStackTrace in class AsynchronouslyInterruptedExceptionpublic void printStackTrace(java.io.PrintStream stream)
printStackTrace in interface StaticThrowable<AsynchronouslyInterruptedException>printStackTrace in class AsynchronouslyInterruptedExceptionstream - A PrintStream for printingpublic void printStackTrace(java.io.PrintWriter writer)
printStackTrace in interface StaticThrowable<AsynchronouslyInterruptedException>printStackTrace in class AsynchronouslyInterruptedExceptionwriter - A PrintWriter for printing