mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Replace transaction.setComplete() by database.commitTransaction()
This commit is contained in:
@@ -199,7 +199,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
boolean canBeRemoved = canBeRemoved(txn, g);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
return canBeRemoved;
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
@@ -228,7 +228,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
||||
for (RemoveBlogHook hook : removeHooks)
|
||||
hook.removingBlog(txn, b);
|
||||
db.removeGroup(txn, b.getGroup());
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
addLocalPost(txn, p);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
//noinspection ThrowFromFinallyBlock
|
||||
db.endTransaction(txn);
|
||||
@@ -309,7 +309,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
||||
meta);
|
||||
BlogPostAddedEvent event = new BlogPostAddedEvent(groupId, h, true);
|
||||
txn.attach(event);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
} catch (GeneralSecurityException e) {
|
||||
@@ -394,7 +394,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
blog = getBlog(txn, g);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -441,7 +441,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
||||
for (Group g : groups) {
|
||||
blogs.add(blogFactory.parseBlog(g));
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -459,7 +459,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
||||
BdfDictionary meta =
|
||||
clientHelper.getMessageMetadataAsDictionary(txn, m);
|
||||
BlogPostHeader h = getPostHeaderFromMetadata(txn, g, m, meta);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
return h;
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
@@ -538,7 +538,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
||||
authorStatuses);
|
||||
headers.add(h);
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
return headers;
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
|
||||
@@ -95,7 +95,7 @@ public abstract class BdfIncomingMessageHook implements IncomingMessageHook,
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
count = getGroupCount(txn, g);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
}
|
||||
finally {
|
||||
db.endTransaction(txn);
|
||||
@@ -157,7 +157,7 @@ public abstract class BdfIncomingMessageHook implements IncomingMessageHook,
|
||||
c.getUnreadCount() + (read ? -1 : 1));
|
||||
clientHelper.mergeGroupMetadata(txn, g, d);
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
} finally {
|
||||
|
||||
@@ -67,7 +67,7 @@ class ClientHelperImpl implements ClientHelper {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
addLocalMessage(txn, m, metadata, shared);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ class ClientHelperImpl implements ClientHelper {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
list = getMessageAsList(txn, m);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ class ClientHelperImpl implements ClientHelper {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
dictionary = getGroupMetadataAsDictionary(txn, g);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ class ClientHelperImpl implements ClientHelper {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
dictionary = getMessageMetadataAsDictionary(txn, m);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -164,7 +164,7 @@ class ClientHelperImpl implements ClientHelper {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
map = getMessageMetadataAsDictionary(txn, g);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -190,7 +190,7 @@ class ClientHelperImpl implements ClientHelper {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
map = getMessageMetadataAsDictionary(txn, g, query);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -216,7 +216,7 @@ class ClientHelperImpl implements ClientHelper {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
mergeGroupMetadata(txn, g, metadata);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -234,7 +234,7 @@ class ClientHelperImpl implements ClientHelper {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
mergeMessageMetadata(txn, m, metadata);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ public class ContactExchangeTaskImpl extends Thread
|
||||
localAuthor.getId(), master, timestamp, alice, true, true);
|
||||
transportPropertyManager.addRemoteProperties(txn, contactId,
|
||||
remoteProperties);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class ContactManagerImpl implements ContactManager {
|
||||
try {
|
||||
c = addContact(txn, remote, local, master, timestamp, alice,
|
||||
verified, active);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class ContactManagerImpl implements ContactManager {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
contact = db.getContact(txn, c);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ class ContactManagerImpl implements ContactManager {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
contacts = db.getContacts(txn);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class ContactManagerImpl implements ContactManager {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
removeContact(txn, c);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ class ContactManagerImpl implements ContactManager {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
exists = contactExists(txn, remoteAuthorId, localAuthorId);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -139,21 +139,28 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endTransaction(Transaction transaction) throws DbException {
|
||||
public void commitTransaction(Transaction transaction) throws DbException {
|
||||
T txn = txnClass.cast(transaction.unbox());
|
||||
if (transaction.isCommitted()) throw new IllegalStateException();
|
||||
transaction.setCommitted();
|
||||
db.commitTransaction(txn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endTransaction(Transaction transaction) {
|
||||
try {
|
||||
T txn = txnClass.cast(transaction.unbox());
|
||||
if (transaction.isComplete()) db.commitTransaction(txn);
|
||||
else db.abortTransaction(txn);
|
||||
if (!transaction.isCommitted()) db.abortTransaction(txn);
|
||||
} finally {
|
||||
if (transaction.isReadOnly()) lock.readLock().unlock();
|
||||
else lock.writeLock().unlock();
|
||||
}
|
||||
if (transaction.isComplete())
|
||||
if (transaction.isCommitted())
|
||||
for (Event e : transaction.getEvents()) eventBus.broadcast(e);
|
||||
}
|
||||
|
||||
private T unbox(Transaction transaction) {
|
||||
if (transaction.isComplete()) throw new IllegalStateException();
|
||||
if (transaction.isCommitted()) throw new IllegalStateException();
|
||||
return txnClass.cast(transaction.unbox());
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ class FeedManagerImpl implements FeedManager, Client, EventListener {
|
||||
List<Feed> feeds = getFeeds(txn);
|
||||
feeds.add(feed);
|
||||
storeFeeds(txn, feeds);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -200,7 +200,7 @@ class FeedManagerImpl implements FeedManager, Client, EventListener {
|
||||
feeds.remove(feed);
|
||||
feeds.add(updatedFeed);
|
||||
storeFeeds(txn, feeds);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -222,7 +222,7 @@ class FeedManagerImpl implements FeedManager, Client, EventListener {
|
||||
}
|
||||
if (!found) throw new DbException();
|
||||
storeFeeds(txn, feeds);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -234,7 +234,7 @@ class FeedManagerImpl implements FeedManager, Client, EventListener {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
feeds = getFeeds(txn);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -405,7 +405,7 @@ class FeedManagerImpl implements FeedManager, Client, EventListener {
|
||||
if (entryTime > lastEntryTime) lastEntryTime = entryTime;
|
||||
}
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
db.addGroup(txn, f.getGroup());
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
||||
for (RemoveForumHook hook : removeHooks)
|
||||
hook.removingForum(txn, f);
|
||||
db.removeGroup(txn, f.getGroup());
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
||||
meta.put(MSG_KEY_READ, true);
|
||||
clientHelper.addLocalMessage(txn, p.getMessage(), meta, true);
|
||||
trackOutgoingMessage(txn, p.getMessage());
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
@@ -176,7 +176,7 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
forum = getForum(txn, g);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -200,7 +200,7 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
groups = db.getGroups(txn, CLIENT_ID);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -252,7 +252,7 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
||||
headers.add(getForumPostHeader(txn, entry.getKey(), meta,
|
||||
statuses));
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
return headers;
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
|
||||
@@ -38,7 +38,7 @@ class IdentityManagerImpl implements IdentityManager {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
cachedAuthor = localAuthor;
|
||||
LOG.info("Local author registered");
|
||||
} finally {
|
||||
@@ -53,7 +53,7 @@ class IdentityManagerImpl implements IdentityManager {
|
||||
try {
|
||||
cachedAuthor = loadLocalAuthor(txn);
|
||||
LOG.info("Local author loaded");
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
Group g2 = getContactGroup(c2);
|
||||
trackMessage(txn, g1.getId(), timestamp, true);
|
||||
trackMessage(txn, g2.getId(), timestamp, true);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -325,7 +325,7 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
|
||||
introduceeManager.acceptIntroduction(txn, state, timestamp);
|
||||
trackMessage(txn, g.getId(), timestamp, true);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -345,7 +345,7 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
|
||||
introduceeManager.declineIntroduction(txn, state, timestamp);
|
||||
trackMessage(txn, g.getId(), timestamp, true);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -458,7 +458,7 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
} finally {
|
||||
|
||||
@@ -140,7 +140,7 @@ class LifecycleManagerImpl implements LifecycleManager {
|
||||
+ " took " + duration + " ms");
|
||||
}
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class ConversationManagerImpl implements ConversationManager {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
contact = db.getContact(txn, contactId);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ class ConversationManagerImpl implements ConversationManager {
|
||||
if (count.getLatestMsgTime() > latestTime)
|
||||
latestTime = count.getLatestMsgTime();
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class MessagingManagerImpl extends ConversationClientImpl
|
||||
meta.put("read", true);
|
||||
clientHelper.addLocalMessage(txn, m.getMessage(), meta, true);
|
||||
trackOutgoingMessage(txn, m.getMessage());
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
@@ -157,7 +157,7 @@ class MessagingManagerImpl extends ConversationClientImpl
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
contact = db.getContact(txn, c);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ class MessagingManagerImpl extends ConversationClientImpl
|
||||
g = getContactGroup(db.getContact(txn, c)).getId();
|
||||
metadata = clientHelper.getMessageMetadataAsDictionary(txn, g);
|
||||
statuses = db.getMessageStatus(txn, c, g);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
} finally {
|
||||
|
||||
@@ -108,7 +108,7 @@ public class PrivateGroupManagerImpl extends BdfIncomingMessageHook implements
|
||||
clientHelper.mergeGroupMetadata(txn, group.getId(), meta);
|
||||
announceNewMember(txn, newMemberMsg);
|
||||
joinPrivateGroup(txn, joinMsg);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
} finally {
|
||||
@@ -145,7 +145,7 @@ public class PrivateGroupManagerImpl extends BdfIncomingMessageHook implements
|
||||
}
|
||||
Group group = db.getGroup(txn, g);
|
||||
db.removeGroup(txn, group);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class PrivateGroupManagerImpl extends BdfIncomingMessageHook implements
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
previousMsgId = getPreviousMsgId(txn, g);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
} finally {
|
||||
@@ -216,7 +216,7 @@ public class PrivateGroupManagerImpl extends BdfIncomingMessageHook implements
|
||||
setPreviousMsgId(txn, m.getMessage().getGroupId(),
|
||||
m.getMessage().getId());
|
||||
trackOutgoingMessage(txn, m.getMessage());
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
} finally {
|
||||
@@ -242,7 +242,7 @@ public class PrivateGroupManagerImpl extends BdfIncomingMessageHook implements
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
privateGroup = getPrivateGroup(txn, g);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -266,7 +266,7 @@ public class PrivateGroupManagerImpl extends BdfIncomingMessageHook implements
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
groups = db.getGroups(txn, getClientId());
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public class PrivateGroupManagerImpl extends BdfIncomingMessageHook implements
|
||||
headers.add(getGroupMessageHeader(txn, g, entry.getKey(), meta,
|
||||
statuses));
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
return headers;
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
@@ -387,7 +387,7 @@ public class PrivateGroupManagerImpl extends BdfIncomingMessageHook implements
|
||||
}
|
||||
members.add(new GroupMember(a, status, shared));
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
return members;
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
|
||||
@@ -101,7 +101,7 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
local = getLocalProperties(txn);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -145,7 +145,7 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
|
||||
latest.messageId);
|
||||
p = parseProperties(message);
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
|
||||
remote.put(c.getId(), parseProperties(message));
|
||||
}
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -222,7 +222,7 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
|
||||
true, true);
|
||||
}
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class SettingsManagerImpl implements SettingsManager {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
s = db.getSettings(txn, namespace);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ class SettingsManagerImpl implements SettingsManager {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
db.mergeSettings(txn, s, namespace);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ abstract class SharingManagerImpl<S extends Shareable, I extends Invitation, IS
|
||||
long time = update.toSend.get(0).getTime();
|
||||
trackMessage(txn, localState.getGroupId(), time, true);
|
||||
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException();
|
||||
} finally {
|
||||
@@ -317,7 +317,7 @@ abstract class SharingManagerImpl<S extends Shareable, I extends Invitation, IS
|
||||
// find session state based on shareable
|
||||
IS localState = getSessionStateForResponse(txn, f, c);
|
||||
respondToInvitation(txn, localState, accept);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
} finally {
|
||||
@@ -333,7 +333,7 @@ abstract class SharingManagerImpl<S extends Shareable, I extends Invitation, IS
|
||||
try {
|
||||
IS localState = (IS) getSessionState(txn, id, true);
|
||||
respondToInvitation(txn, localState, accept);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
} finally {
|
||||
@@ -427,7 +427,7 @@ abstract class SharingManagerImpl<S extends Shareable, I extends Invitation, IS
|
||||
LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
return list;
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
@@ -468,7 +468,7 @@ abstract class SharingManagerImpl<S extends Shareable, I extends Invitation, IS
|
||||
new SharingInvitationItem(s, subscribed, newS);
|
||||
invitations.add(invitation);
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
return Collections.unmodifiableCollection(invitations);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
@@ -514,7 +514,7 @@ abstract class SharingManagerImpl<S extends Shareable, I extends Invitation, IS
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
subscribers = getSharedBy(txn, g);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -547,7 +547,7 @@ abstract class SharingManagerImpl<S extends Shareable, I extends Invitation, IS
|
||||
if (listContains(txn, contactGroup, g, SHARED_BY_US))
|
||||
shared.add(c);
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -563,7 +563,7 @@ abstract class SharingManagerImpl<S extends Shareable, I extends Invitation, IS
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
canBeShared = canBeShared(txn, g, c);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ class DuplexOutgoingSession implements SyncSession, EventListener {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
a = db.generateAck(txn, contactId, MAX_MESSAGE_IDS);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -217,7 +217,7 @@ class DuplexOutgoingSession implements SyncSession, EventListener {
|
||||
try {
|
||||
b = db.generateRequestedBatch(txn, contactId,
|
||||
MAX_PACKET_PAYLOAD_LENGTH, maxLatency);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -259,7 +259,7 @@ class DuplexOutgoingSession implements SyncSession, EventListener {
|
||||
try {
|
||||
o = db.generateOffer(txn, contactId, MAX_MESSAGE_IDS,
|
||||
maxLatency);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -300,7 +300,7 @@ class DuplexOutgoingSession implements SyncSession, EventListener {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
r = db.generateRequest(txn, contactId, MAX_MESSAGE_IDS);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ class IncomingSession implements SyncSession, EventListener {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
db.receiveAck(txn, contactId, ack);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ class IncomingSession implements SyncSession, EventListener {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
db.receiveMessage(txn, contactId, message);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -150,7 +150,7 @@ class IncomingSession implements SyncSession, EventListener {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
db.receiveOffer(txn, contactId, offer);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ class IncomingSession implements SyncSession, EventListener {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
db.receiveRequest(txn, contactId, request);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class SimplexOutgoingSession implements SyncSession, EventListener {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
a = db.generateAck(txn, contactId, MAX_MESSAGE_IDS);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ class SimplexOutgoingSession implements SyncSession, EventListener {
|
||||
try {
|
||||
b = db.generateBatch(txn, contactId,
|
||||
MAX_PACKET_PAYLOAD_LENGTH, maxLatency);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
unvalidated.addAll(db.getMessagesToValidate(txn, c));
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
||||
byte[] raw = db.getRawMessage(txn, id);
|
||||
m = parseMessage(id, raw);
|
||||
g = db.getGroup(txn, m.getGroupId());
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
pending.addAll(db.getPendingMessages(txn, c));
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -228,7 +228,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
||||
}
|
||||
}
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -338,7 +338,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
||||
db.setMessageState(txn, id, PENDING);
|
||||
}
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -397,7 +397,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
toShare.addAll(db.getMessagesToShare(txn, c));
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -430,7 +430,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
||||
MessageId id = toShare.poll();
|
||||
db.setMessageShared(txn, id);
|
||||
toShare.addAll(db.getMessageDependencies(txn, id).keySet());
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -465,7 +465,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
||||
invalidateMessage(txn, id);
|
||||
invalidate.addAll(getDependentsToInvalidate(txn, id));
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -520,7 +520,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
g = db.getGroup(txn, m.getGroupId());
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
|
||||
managers.put(e.getKey(), m);
|
||||
m.start(txn);
|
||||
}
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -123,7 +123,7 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
ctx = m.getStreamContext(txn, c);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
ctx = m.getStreamContext(txn, tag);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ class TransportKeyManager {
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
rotateKeys(txn);
|
||||
txn.setComplete();
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user