public abstract class CertificateOwner implements IdCachable {
+ private static ObjectCache<CertificateOwner> myCache = new ObjectCache<>();
+
private int id;
public CertificateOwner(int id) {
return id;
}
- private static ObjectCache<CertificateOwner> myCache = new ObjectCache<>();
-
public static synchronized CertificateOwner getById(int id) {
CertificateOwner u = myCache.get(id);
if (u == null) {
}
protected int insert() {
- if (id != 0) {
- throw new Error("refusing to insert");
- }
synchronized (User.class) {
+ if (id != 0) {
+ throw new Error("refusing to insert");
+ }
GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("INSERT INTO certOwners() VALUES()");
ps.execute();
id = ps.lastInsertId();
return true;
}
}
+
return false;
}
return true;
}
}
+
return false;
}
ps.execute();
myCache.remove(this);
}
+
}