db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject Re: cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata MetadataManager.java
Date Sat, 12 Jun 2004 17:31:44 GMT
Thomas Dudziak wrote:

> On Sat, 12 Jun 2004, Armin Waibel wrote:
> 
> 
>>Does this cause problems?
>>We have to make sure that it is guaranteed that only one instance of 
>>MetadataManager was created. With the old version it is not guaranteed 
>>(the old singleton problem ;-))
> 
> 
> Well yes, if you want to initialize logging and OJB at runtime (which I'm
> working on at the moment). Any why was this not guaranteed in the old
> version (aside from the fact that there was no synchronized guard in the
> method) ?

Synchronization is the crucial point!
I don't want to make the method synchronized to avoid performance 
decrease. But if you have problems with logging initializing it's ok to 
use the old version with synchronized method.

regards,
Armin

How about:
> 
>     public syncronized static MetadataManager getInstance()
>     {
>         // lazy initialization
>         if (singleton == null)
>         {
>             singleton = new MetadataManager();
>         }
>         return singleton;
>     }
> 
> Shouldn't that work ?
> 
> Tom
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message