Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.ifs.share
Class Task

    java.lang.Object
      oracle.ifs.share.Task

Direct Known Subclasses:
  TimerTask

    public abstract class Task

extends java.lang.Object

Represents a unit of execution to be performed by an Executor.

Constructor Summary
`Task()`

Method Summary
`abstract java.lang.Object` | `call()` Compute the value to be returned by the `get` method.
`protected void` | `complete(java.lang.Object returnValue, java.lang.Throwable error)` Notification by the ExecutionService that the call is complete.
`void` | `finish()` Allow event dispatching thread to complete the task after the `call` method has returned.
`java.lang.Object` | `get()` Return the value created by the `call` method.
`protected Executor` | `getDefaultExecutor()` Get default executor for this task.
`protected Executor` | `getExecutor()` Get current active executor for this task.
`java.lang.Throwable` | `getThrowable()` Return the value created by the `call` method.
`protected long` | `getTimeoutPeriod()` Get the timeout period for this task.
`boolean` | `isDone()` Return true if `call` has completed.
`boolean` | `isFailed()` Return true if `call` failed.
`protected void` | `markCompleted(java.lang.Object returnValue, java.lang.Throwable error)` mark this task as completed.
`void` | `start()` Submit the task for execution.
`void` | `start(Executor executor)` Submit the task for execution on the specified Executor.
`void` | `timeout()` Allow timeout to be performed.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Task

    public Task()

Method Detail

### start

    public void start()

  Description copied from class: `Task`
  Submit the task for execution.

### start

    public void start(Executor executor)

  Description copied from class: `Task`
  Submit the task for execution on the specified Executor.

  Parameters:
    `executor` - the Executor on which to submit the task

### getDefaultExecutor

    protected Executor getDefaultExecutor()

  Description copied from class: `Task`
  Get default executor for this task.

  Subclasses are expected to implement this if the zero-arg variant of start is used.

  Returns:
    the standard Executor used by this task

### getTimeoutPeriod

    protected long getTimeoutPeriod()

  Description copied from class: `Task`
  Get the timeout period for this task.

  Generally this returns 0, but subclasses may override to indicate the amount of time to wait for the next task to be submitted to the Executor. If more than the specified time elapses before a subsequent task is submitted, the Executor will invoke `timeout` on this task.

  Returns:
    the timeout period (in milliseconds) in effect for this task

### getExecutor

    protected Executor getExecutor()

  Description copied from class: `Task`
  Get current active executor for this task.

  Returns null if the Task has not been started.

  Returns:
    the current active executor for this task

### complete

    protected void complete(java.lang.Object returnValue,
                            java.lang.Throwable error)

  Description copied from class: `Task`
  Notification by the ExecutionService that the call is complete.

  This posts an `invokeLater` for the `finish` operation.

  Parameters:
    `returnValue` - the result of the `call` method
    `error` - any error that occurred during `call`

### markCompleted

    protected void markCompleted(java.lang.Object returnValue,
                                 java.lang.Throwable error)

  Description copied from class: `Task`
  mark this task as completed.

  Called as part of `complete`, and performs all actions except ensureing `finish` is called.

  Parameters:
    `returnValue` - the result of the `call` method
    `error` - any error that occurred during `call`

### call

    public abstract java.lang.Object call()
                                   throws java.lang.Exception

  Description copied from class: `Task`
  Compute the value to be returned by the `get` method.

  This is analgous to `construct` in the SwingWorker class.

  Returns:
    the result of the call
  Throws:
    `java.lang.Exception` - if the operation fails

### finish

    public void finish()

  Description copied from class: `Task`
  Allow event dispatching thread to complete the task after the `call` method has returned.

  This is analgous to `finished` in the SwingWorker class.

### timeout

    public void timeout()

  Description copied from class: `Task`
  Allow timeout to be performed.

  Executes in executor's thread, and is called for tasks that return a positive value for `getTimeoutPeriod` and when the subsequent task submitted to the Executor does not occur within the specified period.

### get

    public java.lang.Object get()

  Description copied from class: `Task`
  Return the value created by the `call` method.

  Returns null if an exception occurred in the `call` method.

  Returns:
    the value created by the `call` method

### getThrowable

    public java.lang.Throwable getThrowable()

  Description copied from class: `Task`
  Return the value created by the `call` method.

  Returns null if no exception occurred in the `call` method.

  Returns:
    the value created by the `call` method

### isFailed

    public boolean isFailed()

  Description copied from class: `Task`
  Return true if `call` failed.

  Returns:
    true if the `call` method has failed; false otherwise

### isDone

    public boolean isDone()

  Description copied from class: `Task`
  Return true if `call` has completed.

  Returns:
    true if the `call` method has completed; false otherwise

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD