mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-22 15:49:53 +01:00
Don't lock the list of listeners while calling them.
This commit is contained in:
@@ -198,14 +198,15 @@ DatabaseCleaner.Callback {
|
|||||||
|
|
||||||
/** Notifies all listeners of a database event. */
|
/** Notifies all listeners of a database event. */
|
||||||
private void callListeners(DatabaseEvent e) {
|
private void callListeners(DatabaseEvent e) {
|
||||||
|
List<DatabaseListener> copy;
|
||||||
synchronized(listeners) {
|
synchronized(listeners) {
|
||||||
if(!listeners.isEmpty()) {
|
if(listeners.isEmpty()) return;
|
||||||
// Shuffle the listeners so we don't always send new messages
|
copy = new ArrayList<DatabaseListener>(listeners);
|
||||||
// to contacts in the same order
|
|
||||||
Collections.shuffle(listeners);
|
|
||||||
for(DatabaseListener d : listeners) d.eventOccurred(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// Shuffle the listeners so we don't always send new messages
|
||||||
|
// to contacts in the same order
|
||||||
|
Collections.shuffle(copy);
|
||||||
|
for(DatabaseListener d : copy) d.eventOccurred(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLocalGroupMessage(Message m) throws DbException {
|
public void addLocalGroupMessage(Message m) throws DbException {
|
||||||
|
|||||||
Reference in New Issue
Block a user