|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.zib.scalaris.AbstractTransaction<ReqL,ResL>
ReqL
- RequestList
typeResL
- ResultList
typepublic abstract class AbstractTransaction<ReqL extends RequestList,ResL extends ResultList>
Generic base class for Transaction
and TransactionSingleOp
.
Constructor Summary | |
---|---|
AbstractTransaction()
Constructor, uses the default connection returned by ConnectionFactory.createConnection() . |
|
AbstractTransaction(Connection conn)
Constructor, uses the given connection to an erlang node. |
Method Summary | ||
---|---|---|
void |
addDelOnList(OtpErlangString key,
OtpErlangList toAdd,
OtpErlangList toRemove)
Changes the list stored at the given key, i.e. |
|
|
addDelOnList(String key,
List<T> toAdd,
List<T> toRemove)
Changes the list stored at the given key, i.e. |
|
void |
addOnNr(OtpErlangString key,
OtpErlangDouble toAdd)
Changes the number stored at the given key, i.e. |
|
void |
addOnNr(OtpErlangString key,
OtpErlangLong toAdd)
Changes the number stored at the given key, i.e. |
|
|
addOnNr(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(OtpErlangString key)
Gets the value stored under the given key . |
|
ErlangValue |
read(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(OtpErlangString key,
OtpErlangObject oldValue,
OtpErlangObject newValue)
Stores the given key/new_value pair if the old value at key is old_value (atomic test_and_set). |
|
|
testAndSet(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(OtpErlangString key,
OtpErlangObject value)
Stores the given key /value pair. |
|
|
write(String key,
T value)
Stores the given key /value pair. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractTransaction() throws ConnectionException
ConnectionFactory.createConnection()
.
ConnectionException
- if the connection failspublic AbstractTransaction(Connection conn)
conn
- connection to use for the transactionMethod Detail |
---|
public 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 issue
req
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
AbortException
- if a commit failed (if there was one)
UnknownException
- if any other error occurspublic ErlangValue read(OtpErlangString key) throws ConnectionException, NotFoundException, UnknownException
key
.
key
- the key to look up
key
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
NotFoundException
- if the requested key does not exist
UnknownException
- if any other error occurspublic ErlangValue read(String key) throws ConnectionException, NotFoundException, UnknownException
key
.
key
- the key to look up
key
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
NotFoundException
- if the requested key does not exist
UnknownException
- if any other error occursread(OtpErlangString)
public void write(OtpErlangString key, OtpErlangObject value) throws ConnectionException, AbortException, UnknownException
key
/value
pair.
key
- the key to store the value forvalue
- the value to store
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
AbortException
- if the commit failed (if there was one)
UnknownException
- if any other error occurspublic <T> void write(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 store
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
AbortException
- if the commit failed (if there was one)
UnknownException
- if any other error occurswrite(OtpErlangString, OtpErlangObject)
public void addDelOnList(OtpErlangString key, OtpErlangList toAdd, 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 list
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
NotAListException
- if the previously stored value was no list
AbortException
- if the commit failed (if there was one)
UnknownException
- if any other error occurspublic <T> void addDelOnList(String key, List<T> toAdd, 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 list
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
NotAListException
- if the previously stored value was no list
AbortException
- if the commit failed (if there was one)
UnknownException
- if any other error occursaddDelOnList(OtpErlangString, OtpErlangList, OtpErlangList)
public void addOnNr(OtpErlangString key, 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 cookie
NotANumberException
- if the previously stored value was no number
AbortException
- if the commit failed (if there was one)
UnknownException
- if any other error occursaddOnNr_(AddOnNrOp)
public void addOnNr(OtpErlangString key, 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 cookie
NotANumberException
- if the previously stored value was no number
AbortException
- if the commit failed (if there was one)
UnknownException
- if any other error occursaddOnNr_(AddOnNrOp)
public <T> void addOnNr(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 cookie
NotANumberException
- if the previously stored value was no number
AbortException
- if the commit failed (if there was one)
UnknownException
- if any other error occursaddOnNr(OtpErlangString, OtpErlangLong)
,
addOnNr(OtpErlangString, OtpErlangDouble)
public void testAndSet(OtpErlangString key, OtpErlangObject oldValue, OtpErlangObject newValue) throws ConnectionException, NotFoundException, KeyChangedException, AbortException, UnknownException
key
- the key to store the value foroldValue
- the old value to checknewValue
- the value to store
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
NotFoundException
- if the requested key does not exist
KeyChangedException
- if the key did not match old_value
AbortException
- if the commit failed (if there was one)
UnknownException
- if any other error occurspublic <OldT,NewT> void testAndSet(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 store
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
NotFoundException
- if the requested key does not exist
KeyChangedException
- if the key did not match old_value
AbortException
- if the commit failed (if there was one)
UnknownException
- if any other error occurstestAndSet(OtpErlangString, OtpErlangObject, OtpErlangObject)
public void closeConnection()
ConnectionException
s!
public boolean isCompressed()
public void setCompressed(boolean compressed)
compressed
- true if compressed, otherwise false
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |