T - The result type of the Command.public abstract class BaseCommand<T> extends Object implements Command<T>
Command implementation.| Modifier and Type | Field and Description |
|---|---|
protected MongoNodeStore |
nodeStore |
| Constructor and Description |
|---|
BaseCommand()
Constructs a base command.
|
BaseCommand(MongoNodeStore nodeStore)
Constructs a base command with a mongo connection.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
protected MongoNodeStore nodeStore
public BaseCommand()
public BaseCommand(MongoNodeStore nodeStore)
nodeStore - Node store.public int getNumOfRetries()
CommandCommand 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
Command.needsRetry(Exception) or Command.needsRetry(Object) will be called.
getNumOfRetries in interface Command<T>Command.needsRetry(Exception),
Command.needsRetry(Object)public boolean needsRetry(Exception e)
CommandException during the execution and
a given number of retries which has not exceeded.needsRetry in interface Command<T>e - The Exception which was thrown.true if a retry should be performed, else false.public boolean needsRetry(T result)
CommandThis gives the implementor a chance to retry a false result.
needsRetry in interface Command<T>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.