public interface Interruptible extends Interruptible
Implementations of this interface can be passed to AsynchronouslyInterruptedException.doInterruptible() to pass the code that should be executed in an interruptible way.
| Modifier and Type | Method and Description |
|---|---|
void |
interruptAction(AsynchronouslyInterruptedException exception)
interruptAction will be called when the run() method returned
because it was interrupted asynchronously.
|
default void |
interruptAction(AsynchronouslyInterruptedException exception)
This method is called by the system when the
run() method
is interrupted. |
void |
run(AsynchronouslyInterruptedException exception)
run contains the code that is to be executed in an interruptible
way.
|
default void |
run(AsynchronouslyInterruptedException exception)
The main piece of code that is executed when an implementation
is given to
doInterruptible(). |
void run(AsynchronouslyInterruptedException exception) throws AsynchronouslyInterruptedException
To actually be interruptible, the method implementation has to include the "throws AsynchronouslyInterruptedException" clause that enables asynchronous interruption of the code. The same holds for all methods called by this run method: if their execution should be interruptible, they must include this throws clause.
exception - The AsynchronouslyInterruptedException whose
doInterruptible method called this method.AsynchronouslyInterruptedExceptionvoid interruptAction(AsynchronouslyInterruptedException exception)
exception - The AsynchronouslyInterruptedException that
caused run() to be interrupted.default void run(AsynchronouslyInterruptedException exception) throws AsynchronouslyInterruptedException
InterruptibledoInterruptible().
When a class is created that implements this
interface, for example through an anonymous inner class,
it must include the throws clause
to make the method interruptible.run in interface Interruptibleexception - The AIE object whose doInterruptible method is
calling the run method. Used to invoke methods on
AsynchronouslyInterruptedException from
within the run() method.AsynchronouslyInterruptedExceptiondefault void interruptAction(AsynchronouslyInterruptedException exception)
Interruptiblerun() method
is interrupted. By using this, the program logic can determine
when the run() method completed normally or had its control
asynchronously transferred to its caller.interruptAction in interface Interruptibleexception - The currently pending AIE. Used to invoke methods on
AsynchronouslyInterruptedException from
within the interruptAction() method.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2021 aicas GmbH. All Rights Reserved.