Errai 3.0.1-SNAPSHOT

org.jboss.errai.common.client.api.tasks
Interface AsyncTask

All Known Implementing Classes:
TimedTask

public interface AsyncTask

A handle representing an asynchronous task that has been submitted to the message bus.


Method Summary
 void cancel(boolean interrupt)
          Prevents this task from being scheduled again, optionally interrupting the task if it is currently running.
 boolean isCancelled()
          Returns true if cancel(boolean) has been called on this task, whether it was called from user code or from within the framework because the task threw an exception.
 boolean isFinished()
          Returns true if this task is no longer scheduled to run, either because it executed (successfully or with an error) or cancel(boolean) was called.
 void setExitHandler(Runnable runnable)
          Sets the task that should be run after all executions of this task have completed.
 

Method Detail

cancel

void cancel(boolean interrupt)
Prevents this task from being scheduled again, optionally interrupting the task if it is currently running.

Parameters:
interrupt - if true, and this task is presently being executed, Thread.interrupt() will be called on the thread currently executing this task.

setExitHandler

void setExitHandler(Runnable runnable)
Sets the task that should be run after all executions of this task have completed. The supplied runnable is guaranteed to be invoked exactly once, even if this task has already completed or it has been cancelled.

Parameters:
runnable - the logic to execute when this task has completed all of its executions, either because it completed normally, by throwing an exception, or because it was cancelled by a call to cancel(boolean).

isCancelled

boolean isCancelled()
Returns true if cancel(boolean) has been called on this task, whether it was called from user code or from within the framework because the task threw an exception.

Returns:
true if this task has been cancelled; false otherwise.

isFinished

boolean isFinished()
Returns true if this task is no longer scheduled to run, either because it executed (successfully or with an error) or cancel(boolean) was called.

Returns:
true if this task is no longer scheduled to run.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.