You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2008/12/02 22:33:45 UTC

svn commit: r722620 - /directory/apacheds/branches/apacheds-mina2/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java

Author: elecharny
Date: Tue Dec  2 13:33:45 2008
New Revision: 722620

URL: http://svn.apache.org/viewvc?rev=722620&view=rev
Log:
Applied patch for DISERVER-1293

Modified:
    directory/apacheds/branches/apacheds-mina2/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java

Modified: directory/apacheds/branches/apacheds-mina2/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java?rev=722620&r1=722619&r2=722620&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java (original)
+++ directory/apacheds/branches/apacheds-mina2/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java Tue Dec  2 13:33:45 2008
@@ -78,8 +78,10 @@
 
     /** stores schemas of producers for callback access */
     private ThreadLocal<BootstrapSchema> schemas;
+    
     /** stores registries associated with producers for callback access */
     private ThreadLocal<Registries> registries;
+    
     /** the callback that just calls register() */
     private final ProducerCallback cb = new ProducerCallback()
     {
@@ -151,7 +153,8 @@
         notLoaded.remove( schema.getSchemaName() ); // Remove if user specified it.
         loaded.put( schema.getSchemaName(), schema );
 
-        Iterator list = notLoaded.values().iterator();
+        Iterator<Schema> list = notLoaded.values().iterator();
+        
         while ( list.hasNext() )
         {
             schema = ( BootstrapSchema ) list.next();
@@ -185,10 +188,19 @@
         this.registries.set( registries );
         this.schemas.set( ( BootstrapSchema ) schema );
 
-        for ( ProducerTypeEnum producerType:ProducerTypeEnum.getList() )
+        try
+        {
+            for ( ProducerTypeEnum producerType:ProducerTypeEnum.getList() )
+            {
+                BootstrapProducer producer = getProducer( ( BootstrapSchema ) schema, producerType.getName() );
+                producer.produce( registries, cb );
+            }
+        }
+        finally
         {
-            BootstrapProducer producer = getProducer( ( BootstrapSchema ) schema, producerType.getName() );
-            producer.produce( registries, cb );
+            // Don't forget to release the ThreadLocal variables when done !
+            this.registries.set( null );
+            this.schemas.set( null );
         }
 
         notifyListenerOrRegistries( schema, registries );