Fixed a couple of bugs in settings.

This commit is contained in:
akwizgran
2016-02-05 18:22:37 +00:00
parent bb46f2983f
commit bdc17dfc8e
5 changed files with 35 additions and 23 deletions

View File

@@ -930,15 +930,11 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
}
public void mergeSettings(Settings s, String namespace) throws DbException {
boolean changed = false;
lock.writeLock().lock();
try {
T txn = db.startTransaction();
try {
if (!s.equals(db.getSettings(txn, namespace))) {
db.mergeSettings(txn, s, namespace);
changed = true;
}
db.mergeSettings(txn, s, namespace);
db.commitTransaction(txn);
} catch (DbException e) {
db.abortTransaction(txn);
@@ -947,7 +943,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
} finally {
lock.writeLock().unlock();
}
if (changed) eventBus.broadcast(new SettingsUpdatedEvent());
eventBus.broadcast(new SettingsUpdatedEvent(namespace));
}
public void receiveAck(ContactId c, Ack a) throws DbException {