public abstract class RetriableCommand extends Object
限定符和类型 | 字段和说明 |
---|---|
protected String |
description |
构造器和说明 |
---|
RetriableCommand(String description)
Constructor.
|
RetriableCommand(String description,
RetryPolicy retryPolicy)
Constructor.
|
限定符和类型 | 方法和说明 |
---|---|
protected abstract Object |
doExecute(Object... arguments)
Implement this interface-method define the command-logic that will be
retried on failure (i.e. with Exception).
|
Object |
execute(Object... arguments)
The execute() method invokes doExecute() until either:
1. doExecute() succeeds, or
2. the command may no longer be retried (e.g. runs out of retry-attempts).
|
RetriableCommand |
setRetryPolicy(RetryPolicy retryHandler)
Fluent-interface to change the RetryHandler.
|
protected String description
public RetriableCommand(String description)
description
- The human-readable description of the command.public RetriableCommand(String description, RetryPolicy retryPolicy)
description
- The human-readable description of the command.retryPolicy
- The RetryHandler to be used to compute retries.protected abstract Object doExecute(Object... arguments) throws Exception
arguments
- Argument-list to the command.Exception
- Throws Exception on complete failure.public Object execute(Object... arguments) throws Exception
arguments
- The list of arguments for the command.IOException,
- IOException, on complete failure.Exception
public RetriableCommand setRetryPolicy(RetryPolicy retryHandler)
retryHandler
- The new RetryHandler instance to be used.Copyright © 2009 The Apache Software Foundation