net.spy.concurrent
Interface RetryableCallable<V>

All Superinterfaces:
java.util.concurrent.Callable<V>

public interface RetryableCallable<V>
extends java.util.concurrent.Callable<V>

Interface for callables that may need to be retried if unsuccessful.


Field Summary
static int NO_MORE_RETRIES
          Special return value for getRetryDelay indicating no further retries should be attempted.
 
Method Summary
 long getRetryDelay()
          Get the number of milliseconds we should wait until the next retry.
 void onComplete(boolean successful, java.lang.Object result)
          Invoked when the execution of a retryable is complete.
 void onExecutionException(java.util.concurrent.ExecutionException exception)
          Method called whenever an execution exception occurs while running the call() method.
 
Methods inherited from interface java.util.concurrent.Callable
call
 

Field Detail

NO_MORE_RETRIES

static final int NO_MORE_RETRIES
Special return value for getRetryDelay indicating no further retries should be attempted.

See Also:
Constant Field Values
Method Detail

getRetryDelay

long getRetryDelay()
Get the number of milliseconds we should wait until the next retry.

Returns:
ms to wait if positive, else stop retrying

onExecutionException

void onExecutionException(java.util.concurrent.ExecutionException exception)
Method called whenever an execution exception occurs while running the call() method. This is a good place to count failures and adjust the value to be returned by getRetryDelay().

Parameters:
exception - exception that occured

onComplete

void onComplete(boolean successful,
                java.lang.Object result)
Invoked when the execution of a retryable is complete.

Parameters:
successful - if true, the execution was successful
result - if this execution wasn't successful, the result will be a CompositeExecutorException itemizing the result


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.