Add lots of synchronization.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Sone.java
index f6d5181..129293c 100644 (file)
@@ -49,38 +49,38 @@ public class Sone {
        private final UUID id;
 
        /** The name of this Sone. */
-       private String name;
+       private volatile String name;
 
        /** The URI under which the Sone is stored in Freenet. */
-       private FreenetURI requestUri;
+       private volatile FreenetURI requestUri;
 
        /** The URI used to insert a new version of this Sone. */
        /* This will be null for remote Sones! */
-       private FreenetURI insertUri;
+       private volatile FreenetURI insertUri;
 
        /** The time of the last inserted update. */
-       private long time;
+       private volatile long time;
 
        /** The profile of this Sone. */
-       private Profile profile;
+       private volatile Profile profile;
 
        /** All friend Sones. */
-       private final Set<Sone> friendSones = new HashSet<Sone>();
+       private final Set<Sone> friendSones = Collections.synchronizedSet(new HashSet<Sone>());
 
        /** All posts. */
-       private final Set<Post> posts = new HashSet<Post>();
+       private final Set<Post> posts = Collections.synchronizedSet(new HashSet<Post>());
 
        /** All replies. */
-       private final Set<Reply> replies = new HashSet<Reply>();
+       private final Set<Reply> replies = Collections.synchronizedSet(new HashSet<Reply>());
 
        /** The IDs of all blocked Sones. */
-       private final Set<String> blockedSoneIds = new HashSet<String>();
+       private final Set<String> blockedSoneIds = Collections.synchronizedSet(new HashSet<String>());
 
        /** The IDs of all liked posts. */
-       private final Set<String> likedPostIds = new HashSet<String>();
+       private final Set<String> likedPostIds = Collections.synchronizedSet(new HashSet<String>());
 
        /** The IDs of all liked replies. */
-       private final Set<String> likedReplyIds = new HashSet<String>();
+       private final Set<String> likedReplyIds = Collections.synchronizedSet(new HashSet<String>());
 
        /** Modification count. */
        private volatile long modificationCounter = 0;