ReqL - RequestList typeResL - ResultList typeTransaction, TransactionSingleOppublic abstract class AbstractTransaction<ReqL extends RequestList,ResL extends ResultList>
extends java.lang.Object
Transaction and TransactionSingleOp.| Constructor | Description |
|---|---|
AbstractTransaction() |
Constructor, uses the default connection returned by
ConnectionFactory.createConnection(). |
AbstractTransaction(Connection conn) |
Constructor, uses the given connection to an erlang node.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addDelOnList(com.ericsson.otp.erlang.OtpErlangString key,
com.ericsson.otp.erlang.OtpErlangList toAdd,
com.ericsson.otp.erlang.OtpErlangList toRemove) |
Changes the list stored at the given key, i.e.
|
<T> void |
addDelOnList(java.lang.String key,
java.util.List<T> toAdd,
java.util.List<T> toRemove) |
Changes the list stored at the given key, i.e.
|
void |
addOnNr(com.ericsson.otp.erlang.OtpErlangString key,
com.ericsson.otp.erlang.OtpErlangDouble toAdd) |
Changes the number stored at the given key, i.e.
|
void |
addOnNr(com.ericsson.otp.erlang.OtpErlangString key,
com.ericsson.otp.erlang.OtpErlangLong toAdd) |
Changes the number stored at the given key, i.e.
|
<T> void |
addOnNr(java.lang.String key,
T toAdd) |
Changes the number stored at the given key, i.e.
|
void |
closeConnection() |
Closes the transaction's connection to a scalaris node.
|
boolean |
isCompressed() |
Checks whether the transfer of values is compressed or not.
|
ErlangValue |
read(com.ericsson.otp.erlang.OtpErlangString key) |
Gets the value stored under the given
key. |
ErlangValue |
read(java.lang.String key) |
Gets the value stored under the given
key. |
abstract ResL |
req_list(ReqL req) |
Executes all requests in
req. |
void |
setCompressed(boolean compressed) |
Sets whether to compress the transfer of values or not.
|
void |
testAndSet(com.ericsson.otp.erlang.OtpErlangString key,
com.ericsson.otp.erlang.OtpErlangObject oldValue,
com.ericsson.otp.erlang.OtpErlangObject newValue) |
Stores the given key/new_value pair if the old value at
key is old_value (atomic test_and_set).
|
<OldT,NewT> |
testAndSet(java.lang.String key,
OldT oldValue,
NewT newValue) |
Stores the given key/new_value pair if the old value at
key is old_value (atomic test_and_set).
|
void |
write(com.ericsson.otp.erlang.OtpErlangString key,
com.ericsson.otp.erlang.OtpErlangObject value) |
Stores the given
key/value pair. |
<T> void |
write(java.lang.String key,
T value) |
Stores the given
key/value pair. |
public AbstractTransaction()
throws ConnectionException
ConnectionFactory.createConnection().ConnectionException - if the connection failspublic AbstractTransaction(Connection conn)
conn - connection to use for the transactionpublic abstract ResL req_list(ReqL req) throws ConnectionException, AbortException, UnknownException
req.
The transaction's log is reset if a commit in the request list was successful, otherwise it still retains in the transaction which must be successfully committed, aborted or reset in order to be (re-)used for another request.
req - the requests to issuereqConnectionException - 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 cookieAbortException - if a commit failed (if there was one)UnknownException - if any other error occurspublic ErlangValue read(com.ericsson.otp.erlang.OtpErlangString key) throws ConnectionException, NotFoundException, UnknownException
key.key - the key to look upkeyConnectionException - 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 cookieNotFoundException - if the requested key does not existUnknownException - if any other error occurspublic ErlangValue read(java.lang.String key) throws ConnectionException, NotFoundException, UnknownException
key.key - the key to look upkeyConnectionException - 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 cookieNotFoundException - if the requested key does not existUnknownException - if any other error occursread(OtpErlangString)public void write(com.ericsson.otp.erlang.OtpErlangString key,
com.ericsson.otp.erlang.OtpErlangObject value)
throws ConnectionException,
AbortException,
UnknownException
key/value pair.key - the key to store the value forvalue - the value to storeConnectionException - 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 cookieAbortException - if the commit failed (if there was one)UnknownException - if any other error occurspublic <T> void write(java.lang.String key,
T value)
throws ConnectionException,
AbortException,
UnknownException
key/value pair.T - the type of the valuekey - the key to store the value forvalue - the value to storeConnectionException - 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 cookieAbortException - if the commit failed (if there was one)UnknownException - if any other error occurswrite(OtpErlangString, OtpErlangObject)public void addDelOnList(com.ericsson.otp.erlang.OtpErlangString key,
com.ericsson.otp.erlang.OtpErlangList toAdd,
com.ericsson.otp.erlang.OtpErlangList toRemove)
throws ConnectionException,
NotAListException,
AbortException,
UnknownException
key - the key to write the value totoAdd - a list of values to add to a listtoRemove - a list of values to remove from a listConnectionException - 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 cookieNotAListException - if the previously stored value was no listAbortException - if the commit failed (if there was one)UnknownException - if any other error occurspublic <T> void addDelOnList(java.lang.String key,
java.util.List<T> toAdd,
java.util.List<T> toRemove)
throws ConnectionException,
NotAListException,
AbortException,
UnknownException
key - the key to write the value totoAdd - a list of values to add to a listtoRemove - a list of values to remove from a listConnectionException - 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 cookieNotAListException - if the previously stored value was no listAbortException - if the commit failed (if there was one)UnknownException - if any other error occursaddDelOnList(OtpErlangString, OtpErlangList, OtpErlangList)public void addOnNr(com.ericsson.otp.erlang.OtpErlangString key,
com.ericsson.otp.erlang.OtpErlangLong toAdd)
throws ConnectionException,
NotANumberException,
AbortException,
UnknownException
key - the key to write the value totoAdd - the number to add to the number stored at key (may also be
negative)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 cookieNotANumberException - if the previously stored value was no numberAbortException - if the commit failed (if there was one)UnknownException - if any other error occursaddOnNr_(AddOnNrOp)public void addOnNr(com.ericsson.otp.erlang.OtpErlangString key,
com.ericsson.otp.erlang.OtpErlangDouble toAdd)
throws ConnectionException,
NotANumberException,
AbortException,
UnknownException
key - the key to write the value totoAdd - the number to add to the number stored at key (may also be
negative)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 cookieNotANumberException - if the previously stored value was no numberAbortException - if the commit failed (if there was one)UnknownException - if any other error occursaddOnNr_(AddOnNrOp)public <T> void addOnNr(java.lang.String key,
T toAdd)
throws ConnectionException,
NotANumberException,
AbortException,
UnknownException
key - the key to write the value totoAdd - the number to add to the number stored at key (may also be
negative)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 cookieNotANumberException - if the previously stored value was no numberAbortException - if the commit failed (if there was one)UnknownException - if any other error occursaddOnNr(OtpErlangString, OtpErlangLong),
addOnNr(OtpErlangString, OtpErlangDouble)public void testAndSet(com.ericsson.otp.erlang.OtpErlangString key,
com.ericsson.otp.erlang.OtpErlangObject oldValue,
com.ericsson.otp.erlang.OtpErlangObject newValue)
throws ConnectionException,
NotFoundException,
KeyChangedException,
AbortException,
UnknownException
key - the key to store the value foroldValue - the old value to checknewValue - the value to storeConnectionException - 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 cookieNotFoundException - if the requested key does not existKeyChangedException - if the key did not match old_valueAbortException - if the commit failed (if there was one)UnknownException - if any other error occurspublic <OldT,NewT> void testAndSet(java.lang.String key,
OldT oldValue,
NewT newValue)
throws ConnectionException,
NotFoundException,
KeyChangedException,
AbortException,
UnknownException
key - the key to store the value foroldValue - the old value to checknewValue - the value to storeConnectionException - 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 cookieNotFoundException - if the requested key does not existKeyChangedException - if the key did not match old_valueAbortException - if the commit failed (if there was one)UnknownException - if any other error occurstestAndSet(OtpErlangString, OtpErlangObject, OtpErlangObject)public void closeConnection()
ConnectionExceptions!public boolean isCompressed()
public void setCompressed(boolean compressed)
compressed - true if compressed, otherwise false