net.sf.cindy
Interface Future

All Known Implementing Classes:
DefaultFuture

public interface Future

A Future represents the result of an asynchronous task.

Version:
$id$
Author:
Roger Chen

Method Summary
 void addListener(FutureListener listener)
          Add future listener.
 boolean complete()
          Waits if necessary for the task to complete.
 boolean complete(int timeout)
          Waits if necessary for the task to complete or the timeout period has expired.
 Session getSession()
          Get session associated with the future.
 boolean isCompleted()
          Return true if the task completed.
 boolean isSucceeded()
          Return true if the task completed successful.
 void removeListener(FutureListener listener)
          Remove future listener.
 

Method Detail

getSession

Session getSession()
Get session associated with the future.

Returns:
session

complete

boolean complete()
Waits if necessary for the task to complete. Warn: Block operate may lead to artificially low throughput.

Returns:
is succeeded

complete

boolean complete(int timeout)
Waits if necessary for the task to complete or the timeout period has expired. Warn: Block operate may lead to artificially low throughput.

Parameters:
timeout - timeout
Returns:
is completed

isCompleted

boolean isCompleted()
Return true if the task completed.

Returns:
is completed

isSucceeded

boolean isSucceeded()
Return true if the task completed successful.

Returns:
is succeeded

addListener

void addListener(FutureListener listener)
Add future listener.

Parameters:
listener - future listener

removeListener

void removeListener(FutureListener listener)
Remove future listener.

Parameters:
listener - future listener