directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1133725 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Date Thu, 09 Jun 2011 08:44:40 GMT
Author: elecharny
Date: Thu Jun  9 08:44:39 2011
New Revision: 1133725

URL: http://svn.apache.org/viewvc?rev=1133725&view=rev
Log:
Fix the way partitions are added in the DS : if we have an error in the backend while adding
or removing the partition, it's not added/removed from the partitions set in the DS (cf DIRSERVER-1561)

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1133725&r1=1133724&r2=1133725&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Thu Jun  9 08:44:39 2011
@@ -641,27 +641,47 @@ public class DefaultDirectoryService imp
     public void addPartition( Partition partition ) throws Exception
     {
         partition.setSchemaManager( schemaManager );
+
+        try
+        {
+            partitionNexus.addContextPartition( partition );
+        }
+        catch ( LdapException le )
+        {
+            // We've got an exception, we cannot add the partition to the partitions
+            throw le;
+        }
+        
+        // Now, add the partition to the set of managed partitions
         partitions.add( partition );
 
         if ( ! started )
         {
             return;
         }
-
-        partitionNexus.addContextPartition( partition );
     }
 
 
     public void removePartition( Partition partition ) throws Exception
     {
+        // Do the backend cleanup first
+        try
+        {
+            partitionNexus.removeContextPartition( partition.getSuffix() );
+        }
+        catch ( LdapException le )
+        {
+            // Bad ! We can't go any further
+            throw le;
+        }
+        
+        // And update the set of managed partitions
         partitions.remove( partition );
 
         if ( ! started )
         {
             return;
         }
-
-        partitionNexus.removeContextPartition( partition.getSuffix() );
     }
 
 



Mime
View raw message