Remove sync object, simply sync on own identities.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 11 Nov 2013 21:46:06 +0000 (22:46 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:25:59 +0000 (22:25 +0100)
src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java

index 2933483..2459c06 100644 (file)
@@ -54,12 +54,6 @@ import com.google.inject.name.Named;
  */
 public class IdentityManager extends AbstractService {
 
-       /** Object used for synchronization. */
-       @SuppressWarnings("hiding")
-       private final Object syncObject = new Object() {
-               /* inner class for better lock names. */
-       };
-
        /** The logger. */
        private static final Logger logger = Logging.getLogger(IdentityManager.class);
 
@@ -121,7 +115,7 @@ public class IdentityManager extends AbstractService {
         * @return All own identities
         */
        public Set<OwnIdentity> getAllOwnIdentities() {
-               synchronized (syncObject) {
+               synchronized (currentOwnIdentities) {
                        return new HashSet<OwnIdentity>(currentOwnIdentities);
                }
        }
@@ -142,7 +136,7 @@ public class IdentityManager extends AbstractService {
                                detectChangesInIdentities(currentOwnIdentities, currentIdentities, oldIdentities);
                                oldIdentities = currentIdentities;
 
-                               synchronized (syncObject) {
+                               synchronized (currentOwnIdentities) {
                                        this.currentOwnIdentities.clear();
                                        this.currentOwnIdentities.addAll(currentOwnIdentities);
                                }