public class TxnCounter extends Object implements Transactional
| Constructor and Description |
|---|
TxnCounter(long x) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)
|
void |
begin(ReadWrite readWrite)
Start either a READ or WRITE transaction
|
void |
begin(ReadWrite readWrite,
boolean canBlock) |
void |
commit()
Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)
|
void |
dec()
Decrement the value inside a write transaction
|
void |
end()
Finish the transaction - if a write transaction and commit() has not been called, then abort
|
long |
get()
Return the current value.
|
void |
inc()
Increment the value inside a write transaction
|
boolean |
isInTransaction()
Say whether inside a transaction.
|
long |
read()
Return the current value in a transaction.
|
long |
set(long x)
Set the value inside a write transaction, return the old value
|
long |
value()
Read the current global state (that is, the last committed value) outside a transaction.
|
public void begin(ReadWrite readWrite)
Transactionalbegin in interface Transactionalpublic void begin(ReadWrite readWrite, boolean canBlock)
public void commit()
Transactionalcommit in interface Transactionalpublic void abort()
Transactionalabort in interface Transactionalpublic boolean isInTransaction()
TransactionalisInTransaction in interface Transactionalpublic void end()
Transactionalend in interface Transactionalpublic void inc()
public void dec()
public long set(long x)
public long read()
get()public long get()
TransInteger state is atomic).public long value()
Licenced under the Apache License, Version 2.0