X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Fstorage%2FDatabaseBreaking.java;h=50af618aab8c44f23539401354e0ad946635c55b;hb=5757f37a1bc4e2dcad3054a66611b1a02fb7d8b3;hp=20c894007697c31e279f814bff874a3258b43577;hpb=c6a2204d8d75293256fd17c07e54971d7672359a;p=mir.git diff --git a/source/mircoders/storage/DatabaseBreaking.java b/source/mircoders/storage/DatabaseBreaking.java index 20c89400..50af618a 100755 --- a/source/mircoders/storage/DatabaseBreaking.java +++ b/source/mircoders/storage/DatabaseBreaking.java @@ -21,7 +21,11 @@ public class DatabaseBreaking extends Database implements StorageObject{ private static DatabaseBreaking instance; - public static DatabaseBreaking 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 DatabaseBreaking getInstance() + throws StorageObjectException { if (instance == null) { instance = new DatabaseBreaking(); instance.myselfDatabase = instance;