|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.zib.scalaris.ReplicatedDHT
public class ReplicatedDHT
Provides methods to delete all replicas of the given key
(from 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 Summary | |
---|---|
ReplicatedDHT()
Constructor, uses the default connection returned by ConnectionFactory.createConnection() . |
|
ReplicatedDHT(Connection conn)
Constructor, uses the given connection to an erlang node. |
Method Summary | |
---|---|
void |
closeConnection()
Closes the transaction's connection to a scalaris node. |
DeleteResult |
delete(OtpErlangString key)
Tries to delete all replicas of the given key in 2000ms. |
DeleteResult |
delete(OtpErlangString key,
int timeout)
Tries to delete all replicas of the given key. |
DeleteResult |
delete(String key)
Tries to delete all replicas of the given key in 2000ms. |
DeleteResult |
delete(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) . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReplicatedDHT() throws ConnectionException
ConnectionFactory.createConnection()
.
ConnectionException
- if the connection failspublic ReplicatedDHT(Connection conn)
conn
- connection to use for the transactionMethod Detail |
---|
public DeleteResult delete(OtpErlangString key) throws ConnectionException, TimeoutException, UnknownException
key
- the key to delete
ConnectionException
- 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 cookie
TimeoutException
- if a timeout occurred while trying to delete the value
UnknownException
- if any other error occursdelete(OtpErlangString, int)
public DeleteResult delete(OtpErlangString key, int timeout) throws ConnectionException, TimeoutException, UnknownException
key
- the key to deletetimeout
- the time (in milliseconds) to wait for results
ConnectionException
- 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 cookie
TimeoutException
- if a timeout occurred while trying to delete the value
UnknownException
- if any other error occurspublic DeleteResult delete(String key) throws ConnectionException, TimeoutException, UnknownException
key
- the key to delete
ConnectionException
- 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 cookie
TimeoutException
- if a timeout occurred while trying to delete the value
UnknownException
- if any other error occursdelete(String, int)
public DeleteResult delete(String key, int timeout) throws ConnectionException, TimeoutException, UnknownException
key
- the key to deletetimeout
- the time (in milliseconds) to wait for results
ConnectionException
- 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 cookie
TimeoutException
- if a timeout occurred while trying to delete the value
UnknownException
- 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()
ConnectionException
s!
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |