mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
Moved transactions out of database component.
This commit is contained in:
@@ -4,6 +4,7 @@ import com.google.inject.Inject;
|
||||
|
||||
import org.briarproject.api.db.DatabaseComponent;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.settings.Settings;
|
||||
import org.briarproject.api.settings.SettingsManager;
|
||||
|
||||
@@ -18,11 +19,24 @@ class SettingsManagerImpl implements SettingsManager {
|
||||
|
||||
@Override
|
||||
public Settings getSettings(String namespace) throws DbException {
|
||||
return db.getSettings(namespace);
|
||||
Transaction txn = db.startTransaction();
|
||||
try {
|
||||
Settings s = db.getSettings(txn, namespace);
|
||||
txn.setComplete();
|
||||
return s;
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mergeSettings(Settings s, String namespace) throws DbException {
|
||||
db.mergeSettings(s, namespace);
|
||||
Transaction txn = db.startTransaction();
|
||||
try {
|
||||
db.mergeSettings(txn, s, namespace);
|
||||
txn.setComplete();
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user