|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for Cancelable operation.
An operation is anything which can be runned by a thread. Cancelling an operation remove it from a virtual list of operations to be runned. Implementation are not supposed to use such a list, but for the end-user point of view, operations are in virtual lists, cancelling an operation, remove it from a list. Canceled operation may be reinserted in another virtual list in order to get a chance to be re-executed. Interrupting an operation means interrupting the thread which is running it. Of course, interrupting a terminated operation or a not yet started operation has no effect.
Usually, when a user want to stop an operation it requires two steps :
if (!operation.cancel()) operation.interrupt();
Method Summary | |
boolean |
cancel()
Cancel the operation related to this cancelable object. |
boolean |
interrupt()
Interrupt the operation related to this cancelable object. |
Method Detail |
public boolean cancel()
Cancel the operation related to this cancelable object.
This method does nothing if the related operation is already started or terminated.
This method returns true
if the related operation has
been succesfully cancelled, false
otherwise.
true
if the related operation has been succesfully
cancelled, false
otherwisepublic boolean interrupt()
Interrupt the operation related to this cancelable object.
Interruption of an operation means that the thread which is running
the related operation is interrupted. It is the responsibilty of the
operation to check the interrupt status of the current thread (see
Thread.interrupted()
in order to be able to return as
soon as possible on interruption.
This method does nothing if the related operation is not started yet or if it is already terminated.
This method returns true
if the related operation has
been succesfully interrupted, false
otherwise.
true
if the related operation has been succesfully
interrupted, false
otherwise.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |