FutureTalker V1.3
by Matthew Ford
2005/04/11

au.com.forward.futureTalker
Interface IFutureListener<T>


public interface IFutureListener<T>

Listener interface for FutureTalker


Method Summary
 void futureCancelled(java.util.concurrent.CancellationException cex, FutureTalker<T> talker)
          Called if cancelled.
 void futureError(java.lang.Throwable t, FutureTalker<T> talker)
          Called when the task's Callable.call() exits with an error.
 void futureResult(T result, FutureTalker<T> talker)
          Called on normal completion A call to this method implies the task's call() method has returned without throwing an error.
 

Method Detail

futureResult

void futureResult(T result,
                  FutureTalker<T> talker)
Called on normal completion A call to this method implies the task's call() method has returned without throwing an error.

Parameters:
result - The result return by Callable.call()
talker - the FutureTalker that was run.

futureCancelled

void futureCancelled(java.util.concurrent.CancellationException cex,
                     FutureTalker<T> talker)
Called if cancelled.
A call to this method does NOT imply the task's call() method was ever started.

Note: This method is NOT called if the task was interrupted by some other means other than a call to Future.cancel(boolean).
In particular a call to ThreadPoolExecutor.shutdownNow() does not call Future.cancel(boolean) on any of the queued or running tasks.

You need to provide a RejectedExecutionHandler and override ThreadPoolExecutor.shutdownNow() to call Future.cancel(boolean), if you want this method to be called on rejection and shutdown.

Parameters:
talker - the FutureTalker that was run.
cex - the cancellation exception.

futureError

void futureError(java.lang.Throwable t,
                 FutureTalker<T> talker)
Called when the task's Callable.call() exits with an error.
The throwable passed to this method is the one that was wrapped in the ExecutionException return by a call to Future.get()

A call to this method implies the task's call() method has exited with an error or that FutureTalker.rejected(java.util.concurrent.RejectedExecutionException) was called.

Parameters:
t - the error that cased the task to terminate
talker - the FutureTalker that was run.

©2004, Forward Computing and Control Pty. Ltd
ACN 003 669 994   NSW Australia
All Rights Reserved.