javax.realtime
Interface Interruptible
- public interface Interruptible
Interruptible
is an interface implemented by classes
that will be used as arguments on the doInterruptible()
of
AsynchronouslyInterruptedException
and its subclasses.
doInterruptible()
invokes the implementation of the
method in this interface. Thus the system can ensure correctness
before invoking run()
and correctly cleaned up after run()
returns.
run
public void run(AsynchronouslyInterruptedException exception)
throws AsynchronouslyInterruptedException
- The main piece of code that is executed when an implemention
is given to
doInterruptible()
.
When you create a class that implements this
interface (usually through an anonymous inner class)
you must remember to include the throws
clause
to make the method interruptible. If the throws clause is
omitted the run()
method will not be interruptible.
- Parameters:
exception
- Used to invoke methods on AsynchronouslyInterruptedException
from
within the run()
method.
interruptAction
public void interruptAction(AsynchronouslyInterruptedException exception)
- This method is called by the system if the
run()
method
is excepted. Using this the program logic can determine
if the run()
method completed normally or had its control
asynchronously transferred to its caller.
- Parameters:
exception
- Used to invoke methods on AsynchronouslyInterruptedException
from
within the interruptAction()
method.