From: cvs Date: Mon, 8 Apr 2002 17:50:39 +0000 (+0000) Subject: forgot to synchronize some more DB instances X-Git-Tag: prexmlproducerconfig~131 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=d0c46424c8165575cb388e0f5812b24e2d1b8081;p=mir.git forgot to synchronize some more DB instances --- diff --git a/source/mircoders/storage/DatabaseContent.java b/source/mircoders/storage/DatabaseContent.java index f4301bad..08b407e8 100755 --- a/source/mircoders/storage/DatabaseContent.java +++ b/source/mircoders/storage/DatabaseContent.java @@ -27,7 +27,10 @@ public class DatabaseContent extends Database implements StorageObject { // Contructors / Singleton - public static DatabaseContent 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 DatabaseContent getInstance() throws StorageObjectException { if (instance == null ) { diff --git a/source/mircoders/storage/DatabaseContentToMedia.java b/source/mircoders/storage/DatabaseContentToMedia.java index 90854d72..5807ea5b 100755 --- a/source/mircoders/storage/DatabaseContentToMedia.java +++ b/source/mircoders/storage/DatabaseContentToMedia.java @@ -23,7 +23,10 @@ public class DatabaseContentToMedia extends Database implements StorageObject{ private static DatabaseContentToMedia instance; - public static DatabaseContentToMedia 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 DatabaseContentToMedia getInstance() throws StorageObjectException { if (instance == null) { instance = new DatabaseContentToMedia(); diff --git a/source/mircoders/storage/DatabaseContentToTopics.java b/source/mircoders/storage/DatabaseContentToTopics.java index 8fb8a9ea..dc76e9d9 100755 --- a/source/mircoders/storage/DatabaseContentToTopics.java +++ b/source/mircoders/storage/DatabaseContentToTopics.java @@ -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();