org.sape.carbon.services.threadpool
Interface TaskInfo

All Known Implementing Classes:
TaskInfoImpl

public interface TaskInfo

An object that implements this interface is returned by the ThreadPool execute methods. This object can be used to get information about the status of the task and why it failed. It can also be used to wait until the task completes.
Copyright 2002 Sapient

Since:
carbon 1.2
Version:
$Revision: 1.5 $($Author: dvoet $ / $Date: 2003/11/20 18:49:59 $)
Author:
Douglas Voet, Nov 5, 2002

Method Summary
 Throwable getFailureCause()
          Gets the cause of task failure.
 TaskStatusEnum getStatus()
          Gets the task's status.
 String getTaskName()
          Gets the name of the task as it was passed in to the ThreadPool.execute method.
 void waitUntilExecuted()
          Waits indefinitely for the task to complete.
 void waitUntilExecuted(long miliseconds)
          Waits a given amout of time for the task to complete.
 

Method Detail

getStatus

public TaskStatusEnum getStatus()
Gets the task's status. Note that if either the QueueFullPolicyEnum.DISCARD or QueueFullPolicyEnum.DISCARD_OLDEST policies are used, a task may never get out of the TaskStatusEnum.PENDING state.

Returns:
status

waitUntilExecuted

public void waitUntilExecuted()
                       throws InterruptedException
Waits indefinitely for the task to complete. If the task has already completed, it returns.

Throws:
InterruptedException

waitUntilExecuted

public void waitUntilExecuted(long miliseconds)
                       throws InterruptedException
Waits a given amout of time for the task to complete. You can check the status of the task afterward to see if it actually completed or timed out. If the task has already completed, it returns.

Parameters:
miliseconds - timout in miliseconds
Throws:
InterruptedException

getFailureCause

public Throwable getFailureCause()
Gets the cause of task failure.

Returns:
the exception that caused the failure, or null if the task did not complete or completed successfully.

getTaskName

public String getTaskName()
Gets the name of the task as it was passed in to the ThreadPool.execute method.

Returns:
name


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.