db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata MetadataManager.java
Date Sat, 12 Jun 2004 17:43:46 GMT
arminw      2004/06/12 10:43:46

  Modified:    src/java/org/apache/ojb/broker/metadata MetadataManager.java
  Log:
  rollback changes and synchronize 'getInstance' method
  to guarantee single instance creation
  
  Revision  Changes    Path
  1.19      +8 -3      db-ojb/src/java/org/apache/ojb/broker/metadata/MetadataManager.java
  
  Index: MetadataManager.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/MetadataManager.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- MetadataManager.java	12 Jun 2004 14:38:59 -0000	1.18
  +++ MetadataManager.java	12 Jun 2004 17:43:46 -0000	1.19
  @@ -124,7 +124,7 @@
   
       private static final String MSG_STR = "* Can't find DescriptorRepository for current
thread, use default one *";
       private static ThreadLocal threadedRepository = new ThreadLocal();
  -    private static MetadataManager singleton = new MetadataManager();
  +    private static MetadataManager singleton;
   
       private Hashtable metadataProfiles;
       private DescriptorRepository globalRepository;
  @@ -164,8 +164,13 @@
       /**
        * Returns an instance of this class.
        */
  -    public static MetadataManager getInstance()
  +    public static synchronized MetadataManager getInstance()
       {
  +        // lazy initialization
  +        if (singleton == null)
  +        {
  +            singleton = new MetadataManager();
  +        }
           return singleton;
       }
   
  
  
  

---------------------------------------------------------------------
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