T - The result type of the Command.public interface Command<T>
Command framework provides an way to encapsulate specific actions
of the {code MicroKernel}.
It adds some functionality for retries and other non business logic related actions (i.e. logging, performance tracking, etc).
CommandExecutor| Modifier and Type | Method and Description |
|---|---|
T |
execute()
Executes the
Command and returns its result. |
int |
getNumOfRetries()
Returns the number of retries this
Command should be retried in
case of an error or false result. |
boolean |
needsRetry(Exception e)
Will be called in case of an
Exception during the execution and
a given number of retries which has not exceeded. |
boolean |
needsRetry(T result)
Will be called in case of a successful execution and a given number of
retries which has not exceeded.
|
T execute() throws Exception
Command and returns its result.Exception - If an error occurred while executing.int getNumOfRetries()
Command should be retried in
case of an error or false result.
The number of reties is evaluated in the following way:
In order to determine whether the Command should be retired on
needsRetry(Exception) or needsRetry(Object) will be called.
needsRetry(Exception),
needsRetry(Object)boolean needsRetry(Exception e)
Exception during the execution and
a given number of retries which has not exceeded.e - The Exception which was thrown.true if a retry should be performed, else false.boolean needsRetry(T result)
This gives the implementor a chance to retry a false result.
result - The result of the execution.true if a retry should be performed, else false.Copyright © 2012-2013 The Apache Software Foundation. All Rights Reserved.