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();