Use a lock to ensure transaction isolation. #272

This commit is contained in:
akwizgran
2016-03-24 17:18:54 +00:00
parent 9714713d73
commit 1855dbbd2d
22 changed files with 248 additions and 189 deletions

View File

@@ -51,7 +51,7 @@ class ContactManagerImpl implements ContactManager, RemoveIdentityHook {
long timestamp, boolean alice, boolean active)
throws DbException {
ContactId c;
Transaction txn = db.startTransaction();
Transaction txn = db.startTransaction(false);
try {
c = db.addContact(txn, remote, local, active);
keyManager.addContact(txn, c, master, timestamp, alice);
@@ -68,7 +68,7 @@ class ContactManagerImpl implements ContactManager, RemoveIdentityHook {
@Override
public Contact getContact(ContactId c) throws DbException {
Contact contact;
Transaction txn = db.startTransaction();
Transaction txn = db.startTransaction(true);
try {
contact = db.getContact(txn, c);
txn.setComplete();
@@ -81,7 +81,7 @@ class ContactManagerImpl implements ContactManager, RemoveIdentityHook {
@Override
public Collection<Contact> getActiveContacts() throws DbException {
Collection<Contact> contacts;
Transaction txn = db.startTransaction();
Transaction txn = db.startTransaction(true);
try {
contacts = db.getContacts(txn);
txn.setComplete();
@@ -95,7 +95,7 @@ class ContactManagerImpl implements ContactManager, RemoveIdentityHook {
@Override
public void removeContact(ContactId c) throws DbException {
Transaction txn = db.startTransaction();
Transaction txn = db.startTransaction(false);
try {
removeContact(txn, c);
txn.setComplete();
@@ -107,7 +107,7 @@ class ContactManagerImpl implements ContactManager, RemoveIdentityHook {
@Override
public void setContactActive(ContactId c, boolean active)
throws DbException {
Transaction txn = db.startTransaction();
Transaction txn = db.startTransaction(false);
try {
db.setContactActive(txn, c, active);
txn.setComplete();