bugfixes mainly...
[mir.git] / source / mircoders / storage / DatabaseLinksImcs.java
index eba935e..a2911ef 100755 (executable)
@@ -24,7 +24,11 @@ public class DatabaseLinksImcs extends Database
         * @return
         * @exception StorageObjectException
         */
-       public static DatabaseLinksImcs getInstance () throws StorageObjectException {
+       // 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 DatabaseLinksImcs getInstance () 
+         throws StorageObjectException {
                if (instance == null) {
                        instance = new DatabaseLinksImcs();
                        instance.myselfDatabase = instance;