public class ReplicatedDHT
extends java.lang.Object
api_rdht.erl).
Instances of this class can be generated using a given connection to a
scalaris node using ReplicatedDHT(Connection) or without a
connection (ReplicatedDHT()) in which case a new connection is
created using ConnectionFactory.createConnection().
String key;
int timeout;
DeleteResult result;
TransactionSingleOp sc = new ReplicatedDHT();
sc.delete(key); // delete(String)
sc.delete(key, timeout); // delete(String, int)
result = sc.getLastDeleteResult(); // getLastDeleteResult()
ConnectionPolicy that has been set when the connection
was created. By default, ConnectionFactory uses
DefaultConnectionPolicy which implements automatic connection-retries
by classifying nodes as good or bad depending on their previous state. The
number of automatic retries is adjustable (default: 3).| Constructor | Description |
|---|---|
ReplicatedDHT() |
Constructor, uses the default connection returned by
ConnectionFactory.createConnection(). |
ReplicatedDHT(Connection conn) |
Constructor, uses the given connection to an erlang node.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
closeConnection() |
Closes the transaction's connection to a scalaris node.
|
DeleteResult |
delete(com.ericsson.otp.erlang.OtpErlangString key) |
Tries to delete all replicas of the given key in 2000ms.
|
DeleteResult |
delete(com.ericsson.otp.erlang.OtpErlangString key,
int timeout) |
Tries to delete all replicas of the given key.
|
DeleteResult |
delete(java.lang.String key) |
Tries to delete all replicas of the given key in 2000ms.
|
DeleteResult |
delete(java.lang.String key,
int timeout) |
Tries to delete all replicas of the given key.
|
DeleteResult |
getLastDeleteResult() |
Returns the result of the last call to
delete(String). |
public ReplicatedDHT()
throws ConnectionException
ConnectionFactory.createConnection().ConnectionException - if the connection failspublic ReplicatedDHT(Connection conn)
conn - connection to use for the transactionpublic DeleteResult delete(com.ericsson.otp.erlang.OtpErlangString key) throws ConnectionException, TimeoutException, UnknownException
key - the key to deleteConnectionException - if the connection is not active or a communication error
occurs or an exit signal was received or the remote node
sends a message containing an invalid cookieTimeoutException - if a timeout occurred while trying to delete the valueUnknownException - if any other error occursdelete(OtpErlangString, int)public DeleteResult delete(com.ericsson.otp.erlang.OtpErlangString key, int timeout) throws ConnectionException, TimeoutException, UnknownException
key - the key to deletetimeout - the time (in milliseconds) to wait for resultsConnectionException - if the connection is not active or a communication error
occurs or an exit signal was received or the remote node
sends a message containing an invalid cookieTimeoutException - if a timeout occurred while trying to delete the valueUnknownException - if any other error occurspublic DeleteResult delete(java.lang.String key) throws ConnectionException, TimeoutException, UnknownException
key - the key to deleteConnectionException - if the connection is not active or a communication error
occurs or an exit signal was received or the remote node
sends a message containing an invalid cookieTimeoutException - if a timeout occurred while trying to delete the valueUnknownException - if any other error occursdelete(String, int)public DeleteResult delete(java.lang.String key, int timeout) throws ConnectionException, TimeoutException, UnknownException
key - the key to deletetimeout - the time (in milliseconds) to wait for resultsConnectionException - if the connection is not active or a communication error
occurs or an exit signal was received or the remote node
sends a message containing an invalid cookieTimeoutException - if a timeout occurred while trying to delete the valueUnknownException - if any other error occursdelete(OtpErlangString, int)public DeleteResult getLastDeleteResult()
delete(String).UnknownException - is thrown if an unknown reason was encountereddelete(String)public void closeConnection()
ConnectionExceptions!