X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Fstorage%2FDatabaseImageColor.java;h=776bb18e1e04e0621b494a39f8a8340d1cb16be8;hb=ad39c6eee58bb0ca40cbdabe191e02ec71d248bf;hp=05b895cf67909bfc8e5a069fdcd0e1f68c25db49;hpb=3a661e8f0f659ab5ed2ac0e4d982ac0b398d11f1;p=mir.git diff --git a/source/mircoders/storage/DatabaseImageColor.java b/source/mircoders/storage/DatabaseImageColor.java index 05b895cf..776bb18e 100755 --- a/source/mircoders/storage/DatabaseImageColor.java +++ b/source/mircoders/storage/DatabaseImageColor.java @@ -22,7 +22,11 @@ public class DatabaseImageColor extends Database implements StorageObject{ private static DatabaseImageColor instance; private static SimpleList publisherPopupData; - public static DatabaseImageColor 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 DatabaseImageColor getInstance() + throws StorageObjectException { if (instance == null) { instance = new DatabaseImageColor(); @@ -36,11 +40,10 @@ public class DatabaseImageColor extends Database implements StorageObject{ super(); this.hasTimestamp = false; this.theTable="img_color"; - try { this.theEntityClass = Class.forName("mir.entity.EntityImageColor"); } - catch (Exception e) { throw new StorageObjectException(e.toString()); } } - public SimpleList getPopupData() { return getPopupData("name",true); } + public SimpleList getPopupData() + throws StorageObjectException { return getPopupData("name",true); } }