diff --git a/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java b/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java index ea75baaac854e1be1a18106019dec1f602ccb553..0e68dff94e8c0883bf1c7f1efcce64fb4028bd83 100644 --- a/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java +++ b/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java @@ -58,12 +58,12 @@ Service, EventListener { private final EventBus eventBus; private final Context appContext; private final Map<ContactId, Integer> contactCounts = - new HashMap<ContactId, Integer>(); // Locking: this + new HashMap<ContactId, Integer>(); private final Map<GroupId, Integer> groupCounts = - new HashMap<GroupId, Integer>(); // Locking: this + new HashMap<GroupId, Integer>(); - private int privateTotal = 0, groupTotal = 0; // Locking: this - private int nextRequestId = 0; // Locking: this + private int privateTotal = 0, groupTotal = 0; + private int nextRequestId = 0; private volatile Settings settings = new Settings(); @@ -134,7 +134,6 @@ Service, EventListener { } } - // Locking: this private void updatePrivateMessageNotification() { if(privateTotal == 0) { clearPrivateMessageNotification(); @@ -178,7 +177,6 @@ Service, EventListener { } } - // Locking: this private void clearPrivateMessageNotification() { Object o = appContext.getSystemService(NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) o; @@ -223,7 +221,6 @@ Service, EventListener { } } - // Locking: this private void updateGroupPostNotification() { if(groupTotal == 0) { clearGroupPostNotification(); diff --git a/briar-android/src/org/briarproject/android/ReferenceManagerImpl.java b/briar-android/src/org/briarproject/android/ReferenceManagerImpl.java index 2f2cec75bfed7fe411e595791e00f34474a28b46..70f6afe4259515af9eb3c5456286dc05cbe24326 100644 --- a/briar-android/src/org/briarproject/android/ReferenceManagerImpl.java +++ b/briar-android/src/org/briarproject/android/ReferenceManagerImpl.java @@ -18,7 +18,7 @@ class ReferenceManagerImpl implements ReferenceManager { private final Map<Class<?>, Map<Long, Object>> outerMap = new HashMap<Class<?>, Map<Long, Object>>(); - private long nextHandle = 0; // Locking: this + private long nextHandle = 0; private final Lock synchLock = new ReentrantLock(); diff --git a/briar-core/src/org/briarproject/crypto/FortunaGenerator.java b/briar-core/src/org/briarproject/crypto/FortunaGenerator.java index 05863f3b6981ac2ed7fa49105d26e6c03ea3e02e..9e7ee2dd3d8403bcf59633499c66974ed7094736 100644 --- a/briar-core/src/org/briarproject/crypto/FortunaGenerator.java +++ b/briar-core/src/org/briarproject/crypto/FortunaGenerator.java @@ -19,7 +19,6 @@ class FortunaGenerator { private static final int KEY_BYTES = 32; private static final int BLOCK_BYTES = 16; - // All of the following are locking: this private final MessageDigest digest = new DoubleDigest(new SHA256Digest()); private final BlockCipher cipher = new AESLightEngine(); private final byte[] key = new byte[KEY_BYTES]; diff --git a/briar-core/src/org/briarproject/crypto/SecretKeyImpl.java b/briar-core/src/org/briarproject/crypto/SecretKeyImpl.java index f806c95c75c26ded931848571dd35a6e9c74beb9..f37685cd17860279f57d6c2bf7af27c35ba203c6 100644 --- a/briar-core/src/org/briarproject/crypto/SecretKeyImpl.java +++ b/briar-core/src/org/briarproject/crypto/SecretKeyImpl.java @@ -10,7 +10,7 @@ class SecretKeyImpl implements SecretKey { private final byte[] key; - private boolean erased = false; // Locking: this + private boolean erased = false; private final Lock synchLock = new ReentrantLock(); diff --git a/briar-core/src/org/briarproject/db/JdbcDatabase.java b/briar-core/src/org/briarproject/db/JdbcDatabase.java index f8b7133aafe1a8c99f521dc9b845b1de21384c9b..57b596f7efdde420370cd9a60471b19534ad02a9 100644 --- a/briar-core/src/org/briarproject/db/JdbcDatabase.java +++ b/briar-core/src/org/briarproject/db/JdbcDatabase.java @@ -316,12 +316,12 @@ abstract class JdbcDatabase implements Database<Connection> { private final Clock clock; private final LinkedList<Connection> connections = - new LinkedList<Connection>(); // Locking: self + new LinkedList<Connection>(); private final AtomicInteger transactionCount = new AtomicInteger(0); - private int openConnections = 0; // Locking: connections - private boolean closed = false; // Locking: connections + private int openConnections = 0; + private boolean closed = false; protected abstract Connection createConnection() throws SQLException; protected abstract void flushBuffersToDisk(Statement s) throws SQLException; diff --git a/briar-core/src/org/briarproject/invitation/ConnectorGroup.java b/briar-core/src/org/briarproject/invitation/ConnectorGroup.java index c0f04c2231d6a3876d850d8b94485fa47fe225d9..a2481915f1034678c682b3fa312add1004792e0f 100644 --- a/briar-core/src/org/briarproject/invitation/ConnectorGroup.java +++ b/briar-core/src/org/briarproject/invitation/ConnectorGroup.java @@ -65,10 +65,7 @@ class ConnectorGroup extends Thread implements InvitationTask { private final Lock synchLock = new ReentrantLock(); - /* - * All of the following require locking: this. We don't want to call the - * listeners with a lock held, but we need to avoid a race condition in - * addListener(), so the state that's accessed in addListener() after + /*The state that's accessed in addListener() after * calling listeners.add() must be guarded by a lock. */ private int localConfirmationCode = -1, remoteConfirmationCode = -1; diff --git a/briar-core/src/org/briarproject/lifecycle/ShutdownManagerImpl.java b/briar-core/src/org/briarproject/lifecycle/ShutdownManagerImpl.java index 89e214d0e84e90f50e84066d654de19cba30722b..6427a6d3111c1af44b0f30278555649ae197f5c3 100644 --- a/briar-core/src/org/briarproject/lifecycle/ShutdownManagerImpl.java +++ b/briar-core/src/org/briarproject/lifecycle/ShutdownManagerImpl.java @@ -9,9 +9,9 @@ import org.briarproject.api.lifecycle.ShutdownManager; class ShutdownManagerImpl implements ShutdownManager { - protected final Map<Integer, Thread> hooks; // Locking: this + protected final Map<Integer, Thread> hooks; - private int nextHandle = 0; // Locking: this + private int nextHandle = 0; private final Lock synchLock = new ReentrantLock(); diff --git a/briar-core/src/org/briarproject/reliability/Receiver.java b/briar-core/src/org/briarproject/reliability/Receiver.java index 801d60c0f3ffef090eb25e57abdf61ae2fa7df3d..3b2254bf48df2b5265542682ea2b603b4e43f8b0 100644 --- a/briar-core/src/org/briarproject/reliability/Receiver.java +++ b/briar-core/src/org/briarproject/reliability/Receiver.java @@ -20,9 +20,9 @@ class Receiver implements ReadHandler { private final Clock clock; private final Sender sender; - private final SortedSet<Data> dataFrames; // Locking: this + private final SortedSet<Data> dataFrames; - private int windowSize = MAX_WINDOW_SIZE; // Locking: this + private int windowSize = MAX_WINDOW_SIZE; private long finalSequenceNumber = Long.MAX_VALUE; private long nextSequenceNumber = 1; diff --git a/briar-core/src/org/briarproject/reliability/Sender.java b/briar-core/src/org/briarproject/reliability/Sender.java index 1804da5eff749e5d3b903c8947f180697e9c2603..97615db73b649dd647f489d9ea8c7a0dfba7b2c4 100644 --- a/briar-core/src/org/briarproject/reliability/Sender.java +++ b/briar-core/src/org/briarproject/reliability/Sender.java @@ -25,9 +25,8 @@ class Sender { private final Clock clock; private final WriteHandler writeHandler; - private final LinkedList<Outstanding> outstanding; // Locking: this + private final LinkedList<Outstanding> outstanding; - // All of the following are locking: this private int outstandingBytes = 0; private int windowSize = Data.MAX_PAYLOAD_LENGTH; private int rtt = INITIAL_RTT, rttVar = INITIAL_RTT_VAR; diff --git a/briar-core/src/org/briarproject/transport/KeyManagerImpl.java b/briar-core/src/org/briarproject/transport/KeyManagerImpl.java index a267e6213885229f13845495b6ac2b661c470078..6ab1688506300266c960a55e95ab3b5534e8ea1b 100644 --- a/briar-core/src/org/briarproject/transport/KeyManagerImpl.java +++ b/briar-core/src/org/briarproject/transport/KeyManagerImpl.java @@ -52,7 +52,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener { private final Clock clock; private final Timer timer; - // All of the following are locking: this private final Map<TransportId, Long> maxLatencies; private final Map<EndpointKey, TemporarySecret> oldSecrets; private final Map<EndpointKey, TemporarySecret> currentSecrets; @@ -120,7 +119,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener { } // Assigns secrets to the appropriate maps and returns any dead secrets - // Locking: this private Collection<TemporarySecret> assignSecretsToMaps(long now, Collection<TemporarySecret> secrets) { Collection<TemporarySecret> dead = new ArrayList<TemporarySecret>(); @@ -154,7 +152,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener { } // Replaces and erases the given secrets and returns any secrets created - // Locking: this private Collection<TemporarySecret> replaceDeadSecrets(long now, Collection<TemporarySecret> dead) { // If there are several dead secrets for an endpoint, use the newest @@ -242,7 +239,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener { } } - // Locking: this private void removeAndEraseSecrets(Map<?, TemporarySecret> m) { for(TemporarySecret s : m.values()) ByteUtils.erase(s.getSecret()); m.clear(); @@ -374,7 +370,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener { } } - // Locking: this private void removeAndEraseSecrets(ContactId c, Map<?, TemporarySecret> m) { Iterator<TemporarySecret> it = m.values().iterator(); while(it.hasNext()) { @@ -386,7 +381,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener { } } - // Locking: this private void removeAndEraseSecrets(TransportId t, Map<?, TemporarySecret> m) { Iterator<TemporarySecret> it = m.values().iterator(); diff --git a/briar-core/src/org/briarproject/transport/TagRecogniserImpl.java b/briar-core/src/org/briarproject/transport/TagRecogniserImpl.java index 73af53dc13201b1b9aca7269d57b977e18384015..30d0054acaa6b749c40ae2d4d3b6418cd1ec0aa9 100644 --- a/briar-core/src/org/briarproject/transport/TagRecogniserImpl.java +++ b/briar-core/src/org/briarproject/transport/TagRecogniserImpl.java @@ -20,7 +20,7 @@ class TagRecogniserImpl implements TagRecogniser { private final CryptoComponent crypto; private final DatabaseComponent db; - // Locking: this + private final Map<TransportId, TransportTagRecogniser> recognisers; private final Lock synchLock = new ReentrantLock(); diff --git a/briar-core/src/org/briarproject/transport/TransportTagRecogniser.java b/briar-core/src/org/briarproject/transport/TransportTagRecogniser.java index b8eb15e2c8781f06d4fbd704aab4b3458ab73a8e..353681d498280ac4260fd40ac670439407974a3a 100644 --- a/briar-core/src/org/briarproject/transport/TransportTagRecogniser.java +++ b/briar-core/src/org/briarproject/transport/TransportTagRecogniser.java @@ -29,8 +29,8 @@ class TransportTagRecogniser { private final CryptoComponent crypto; private final DatabaseComponent db; private final TransportId transportId; - private final Map<Bytes, TagContext> tagMap; // Locking: this - private final Map<RemovalKey, RemovalContext> removalMap; // Locking: this + private final Map<Bytes, TagContext> tagMap; + private final Map<RemovalKey, RemovalContext> removalMap; private final Lock synchLock = new ReentrantLock(); @@ -119,7 +119,6 @@ class TransportTagRecogniser { } } - // Locking: this private void removeSecret(RemovalContext r) { // Remove the expected tags SecretKey key = crypto.deriveTagKey(r.secret, !r.alice); diff --git a/briar-desktop/src/org/briarproject/lifecycle/WindowsShutdownManagerImpl.java b/briar-desktop/src/org/briarproject/lifecycle/WindowsShutdownManagerImpl.java index 7452d7844fd9d49d0a700bce59373015a041d362..bb21e6c4b37aa7168a068f42539a5ca0fb4085e5 100644 --- a/briar-desktop/src/org/briarproject/lifecycle/WindowsShutdownManagerImpl.java +++ b/briar-desktop/src/org/briarproject/lifecycle/WindowsShutdownManagerImpl.java @@ -39,7 +39,7 @@ class WindowsShutdownManagerImpl extends ShutdownManagerImpl { private final Map<String, Object> options; - private boolean initialised = false; // Locking: this + private boolean initialised = false; private final Lock synchLock = new ReentrantLock(); @@ -69,7 +69,6 @@ class WindowsShutdownManagerImpl extends ShutdownManagerImpl { return new StartOnce(r); } - // Locking: this private void initialise() { if(OsUtils.isWindows()) { new EventLoop().start(); diff --git a/briar-desktop/src/org/briarproject/plugins/file/UnixRemovableDriveMonitor.java b/briar-desktop/src/org/briarproject/plugins/file/UnixRemovableDriveMonitor.java index ac9c1b3782d25035f435df4070bd96105129746c..00335b94746c2e952c5c46c92a16d46cf2839764 100644 --- a/briar-desktop/src/org/briarproject/plugins/file/UnixRemovableDriveMonitor.java +++ b/briar-desktop/src/org/briarproject/plugins/file/UnixRemovableDriveMonitor.java @@ -14,14 +14,13 @@ import net.contentobjects.jnotify.JNotifyListener; abstract class UnixRemovableDriveMonitor implements RemovableDriveMonitor, JNotifyListener { - private static boolean triedLoad = false; // Locking: class - private static Throwable loadError = null; // Locking: class + private static boolean triedLoad = false; + private static Throwable loadError = null; - // Locking: this private final List<Integer> watches = new ArrayList<Integer>(); - private boolean started = false; // Locking: this - private Callback callback = null; // Locking: this + private boolean started = false; + private Callback callback = null; protected abstract String[] getPathsToWatch(); diff --git a/briar-desktop/src/org/briarproject/plugins/modem/ModemImpl.java b/briar-desktop/src/org/briarproject/plugins/modem/ModemImpl.java index 1f1e00394fb9c538ad8eeb21dcd8c0b937cc6906..8f29f273f701fd098ce5bc82194ddd0395e1b901 100644 --- a/briar-desktop/src/org/briarproject/plugins/modem/ModemImpl.java +++ b/briar-desktop/src/org/briarproject/plugins/modem/ModemImpl.java @@ -46,8 +46,8 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener { private int lineLen = 0; - private ReliabilityLayer reliability = null; // Locking: this - private boolean initialised = false, connected = false; // Locking: this + private ReliabilityLayer reliability = null; + private boolean initialised = false, connected = false; private final Lock synchLock = new ReentrantLock(); private final Condition connectedStateChanged = synchLock.newCondition(); @@ -163,7 +163,6 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener { } } - // Locking: stateChange private void hangUpInner() throws IOException { ReliabilityLayer reliability; synchLock.lock();