]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/dbObjects/EmailAddress.java
FIX: synchronization for IDCachable-Objects
[gigi.git] / src / org / cacert / gigi / dbObjects / EmailAddress.java
index 2acf59006e257f33fd7cf2f9bb493dbd05e23372..1191952f7e236ee93c1ab09fe8facfd3f8d5bfe5 100644 (file)
@@ -106,13 +106,11 @@ public class EmailAddress implements IdCachable {
 
     private static ObjectCache<EmailAddress> myCache = new ObjectCache<>();
 
-    public static EmailAddress getById(int id) throws IllegalArgumentException {
+    public static synchronized EmailAddress getById(int id) throws IllegalArgumentException {
         EmailAddress em = myCache.get(id);
         if (em == null) {
             try {
-                synchronized (EmailAddress.class) {
-                    myCache.put(em = new EmailAddress(id));
-                }
+                myCache.put(em = new EmailAddress(id));
             } catch (SQLException e1) {
                 throw new IllegalArgumentException(e1);
             }