mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Use a lock to ensure transaction isolation. #272
This commit is contained in:
@@ -12,12 +12,14 @@ import java.util.List;
|
||||
public class Transaction {
|
||||
|
||||
private final Object txn;
|
||||
private final boolean readOnly;
|
||||
|
||||
private List<Event> events = null;
|
||||
private boolean complete = false;
|
||||
|
||||
public Transaction(Object txn) {
|
||||
public Transaction(Object txn, boolean readOnly) {
|
||||
this.txn = txn;
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,6 +30,13 @@ public class Transaction {
|
||||
return txn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the transaction can only be used for reading.
|
||||
*/
|
||||
public boolean isReadOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches an event to be broadcast when the transaction has been
|
||||
* committed.
|
||||
|
||||
Reference in New Issue
Block a user