Task
Enum AbstractTask.State

java.lang.Object
  extended by java.lang.Enum<AbstractTask.State>
      extended by Task.AbstractTask.State
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<AbstractTask.State>
Enclosing class:
AbstractTask

public static enum AbstractTask.State
extends java.lang.Enum<AbstractTask.State>

List of all the possible states that any kind of Task (Network, non network, etc) may have. The lifecycle begins with Started, and ends in Stopped (regardless of the outcome). Once, Stopped, it may transition to OK, Interrupted, Err, Cancelled. For networked tasks, that are not online, it goes from Started to Stopped to NotOnline. Bascially, Stopped is called pretty much any time after Started - you can put code in there to turn off busy label, etc or something like that.


Enum Constant Summary
Cancelled
          After task is Started, if AbstractTask.getSwingWorker().cancel() is called, this state is reached as soon as the SwingWorker's (and TaskExecutorIF's) doInBackground method completes (is done()).
Err
          after task is Stopped, result is bad - Err.
Interrupted
          Task is interrupted.
NotOnline
          after task is Stopped, if container is not in ONLINE mode.
OK
          after task is Stopped, result is good - OK
Started
          task is started
Stopped
          task is stopped - regardless of Err, OK, or NotOnline
 
Method Summary
static AbstractTask.State valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static AbstractTask.State[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

Started

public static final AbstractTask.State Started
task is started


Stopped

public static final AbstractTask.State Stopped
task is stopped - regardless of Err, OK, or NotOnline


Interrupted

public static final AbstractTask.State Interrupted
Task is interrupted. Stopped, OK, or Err never get called. Cancel trumps Interrupted - the task may be interrupted by someone calling cancel on the SwingWorker (AbstractTask.getSwingWorker(). There are a very few conditions in which the SwingWorker can be interrupted - if it's wait()ing for example, or blocking on some other operation.


OK

public static final AbstractTask.State OK
after task is Stopped, result is good - OK


Err

public static final AbstractTask.State Err
after task is Stopped, result is bad - Err. If Err is an AuthToken violation OFFLINE mode is activated


Cancelled

public static final AbstractTask.State Cancelled
After task is Started, if AbstractTask.getSwingWorker().cancel() is called, this state is reached as soon as the SwingWorker's (and TaskExecutorIF's) doInBackground method completes (is done()). This is different than when IO operations are interrupted, which is supported by UIHookIF. The IO layer is supposed to generate an InterruptedIOException, which gets thrown as an MBException, which the task catches as an ExecutionException, and reports to the SimpleTaskHandlerIF as an Err.

Cancel is for the case where task is simply unaware that cancel() was called on it's SwingWorker, while it was running the executor's doInBackground method. This is needed since Java does not support pre-empting running threads. They pretty much have to complete, then realize that they were cancelled, and then the results have to be thrown away (and this has to be reported to the TaskHandler).

This is different from Interruped, which can be reached only if the tread is in a state where InterruptedException can be thrown on the SwingWorker (which might be the result of cancel(true) being called on it). The SwingWorker will be interruptible only under a few circumstances (waiting, etc). So Cancel trumps Interrupted.


NotOnline

public static final AbstractTask.State NotOnline
after task is Stopped, if container is not in ONLINE mode. TaskExecutorIF was not run.

Method Detail

values

public static AbstractTask.State[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (AbstractTask.State c : AbstractTask.State.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static AbstractTask.State valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null


Copyright © 2011. All Rights Reserved.