mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Remove unnecessary throwing variants.
This commit is contained in:
@@ -79,27 +79,14 @@ public interface DatabaseComponent {
|
|||||||
/**
|
/**
|
||||||
* Runs the given task within a transaction.
|
* Runs the given task within a transaction.
|
||||||
*/
|
*/
|
||||||
void transaction(boolean readOnly, DbRunnable<DbException> task)
|
<E extends Exception> void transaction(boolean readOnly,
|
||||||
throws DbException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs the given task within a transaction and returns the result of the
|
|
||||||
* task.
|
|
||||||
*/
|
|
||||||
<R> R transactionWithResult(boolean readOnly,
|
|
||||||
DbCallable<R, DbException> task) throws DbException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs the given task within a transaction.
|
|
||||||
*/
|
|
||||||
<E extends Exception> void throwingTransaction(boolean readOnly,
|
|
||||||
DbRunnable<E> task) throws DbException, E;
|
DbRunnable<E> task) throws DbException, E;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the given task within a transaction and returns the result of the
|
* Runs the given task within a transaction and returns the result of the
|
||||||
* task.
|
* task.
|
||||||
*/
|
*/
|
||||||
<R, E extends Exception> R throwingTransactionWithResult(boolean readOnly,
|
<R, E extends Exception> R transactionWithResult(boolean readOnly,
|
||||||
DbCallable<R, E> task) throws DbException, E;
|
DbCallable<R, E> task) throws DbException, E;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -169,19 +169,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transaction(boolean readOnly, DbRunnable<DbException> task)
|
public <E extends Exception> void transaction(boolean readOnly,
|
||||||
throws DbException {
|
|
||||||
throwingTransaction(readOnly, task);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <R> R transactionWithResult(boolean readOnly,
|
|
||||||
DbCallable<R, DbException> task) throws DbException {
|
|
||||||
return throwingTransactionWithResult(readOnly, task);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <E extends Exception> void throwingTransaction(boolean readOnly,
|
|
||||||
DbRunnable<E> task) throws DbException, E {
|
DbRunnable<E> task) throws DbException, E {
|
||||||
final Transaction txn = startTransaction(readOnly);
|
final Transaction txn = startTransaction(readOnly);
|
||||||
try {
|
try {
|
||||||
@@ -193,8 +181,8 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <R, E extends Exception> R throwingTransactionWithResult(
|
public <R, E extends Exception> R transactionWithResult(boolean readOnly,
|
||||||
boolean readOnly, DbCallable<R, E> task) throws DbException, E {
|
DbCallable<R, E> task) throws DbException, E {
|
||||||
final Transaction txn = startTransaction(readOnly);
|
final Transaction txn = startTransaction(readOnly);
|
||||||
try {
|
try {
|
||||||
R result = task.call(txn);
|
R result = task.call(txn);
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
|||||||
public Collection<ForumPostHeader> getPostHeaders(GroupId g)
|
public Collection<ForumPostHeader> getPostHeaders(GroupId g)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
try {
|
try {
|
||||||
return db.throwingTransactionWithResult(true, txn -> {
|
return db.transactionWithResult(true, txn -> {
|
||||||
Collection<ForumPostHeader> headers = new ArrayList<>();
|
Collection<ForumPostHeader> headers = new ArrayList<>();
|
||||||
Map<MessageId, BdfDictionary> metadata =
|
Map<MessageId, BdfDictionary> metadata =
|
||||||
clientHelper.getMessageMetadataAsDictionary(txn, g);
|
clientHelper.getMessageMetadataAsDictionary(txn, g);
|
||||||
|
|||||||
Reference in New Issue
Block a user