bugfixes mainly...
[mir.git] / source / mircoders / storage / DatabaseContentToTopics.java
index 8fb8a9e..dc76e9d 100755 (executable)
@@ -23,7 +23,10 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
 
   private static DatabaseContentToTopics instance;
 
-  public static DatabaseContentToTopics getInstance()
+  // the following *has* to be sychronized cause this static method
+  // could get preemted and we could end up with 2 instances of DatabaseFoo.
+  // see the "Singletons with needles and thread" article at JavaWorld -mh
+  public synchronized static DatabaseContentToTopics getInstance()
     throws StorageObjectException {
     if (instance == null) {
       instance = new DatabaseContentToTopics();