mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
Don't start transactions while holding locks. #272
This commit is contained in:
@@ -26,10 +26,6 @@ import java.util.Map;
|
||||
/**
|
||||
* Encapsulates the database implementation and exposes high-level operations
|
||||
* to other components.
|
||||
* <p/>
|
||||
* This interface's methods are blocking, but they do not call out into other
|
||||
* components except to broadcast {@link org.briarproject.api.event.Event
|
||||
* Events}, so they can safely be called while holding locks.
|
||||
*/
|
||||
public interface DatabaseComponent {
|
||||
|
||||
@@ -45,6 +41,9 @@ public interface DatabaseComponent {
|
||||
|
||||
/**
|
||||
* Starts a new transaction and returns an object representing it.
|
||||
* <p/>
|
||||
* This method acquires locks, so it must not be called while holding a
|
||||
* lock.
|
||||
* @param readOnly true if the transaction will only be used for reading.
|
||||
*/
|
||||
Transaction startTransaction(boolean readOnly) throws DbException;
|
||||
|
||||
@@ -26,12 +26,14 @@ public interface KeyManager {
|
||||
* contact over the given transport, or null if an error occurs or the
|
||||
* contact does not support the transport.
|
||||
*/
|
||||
StreamContext getStreamContext(ContactId c, TransportId t);
|
||||
StreamContext getStreamContext(ContactId c, TransportId t)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Looks up the given tag and returns a {@link StreamContext} for reading
|
||||
* from the corresponding stream, or null if an error occurs or the tag was
|
||||
* unexpected.
|
||||
*/
|
||||
StreamContext getStreamContext(TransportId t, byte[] tag);
|
||||
StreamContext getStreamContext(TransportId t, byte[] tag)
|
||||
throws DbException;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user