directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r109774 - in incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve: . db db/jdbm
Date Sat, 04 Dec 2004 05:28:12 GMT
Author: akarasulu
Date: Fri Dec  3 21:28:11 2004
New Revision: 109774

URL: http://svn.apache.org/viewcvs?view=rev&rev=109774
Log:
Changes ...

 o added isClosed() check method to interfaces Database, and BackingStore
 o implemented isClosed in JdbmDatabase, AbstarctContextPartition, and RootNexus

These changes are fixes for the following issue:

  http://nagoya.apache.org/jira/browse/DIREVE-99


Modified:
   incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/AbstractContextPartition.java
   incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/BackingStore.java
   incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java
   incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/Database.java
   incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/jdbm/JdbmDatabase.java

Modified: incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/AbstractContextPartition.java
Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/AbstractContextPartition.java?view=diff&rev=109774&p1=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/AbstractContextPartition.java&r1=109773&p2=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/AbstractContextPartition.java&r2=109774
==============================================================================
--- incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/AbstractContextPartition.java
(original)
+++ incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/AbstractContextPartition.java
Fri Dec  3 21:28:11 2004
@@ -384,6 +384,12 @@
     }
 
 
+    public boolean isClosed()
+    {
+        return db.isClosed();
+    }
+
+
     public void inspect() throws Exception
     {
         PartitionViewer viewer = new PartitionViewer( db, engine );

Modified: incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/BackingStore.java
Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/BackingStore.java?view=diff&rev=109774&p1=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/BackingStore.java&r1=109773&p2=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/BackingStore.java&r2=109774
==============================================================================
--- incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/BackingStore.java
(original)
+++ incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/BackingStore.java
Fri Dec  3 21:28:11 2004
@@ -223,11 +223,20 @@
     void sync() throws NamingException;
 
     /**
-     * Closes or shuts down this BackingStore.
+     * Closes or shuts down this BackingStore.  Operations against closed
+     * BackingStores will fail.
      *
      * @throws NamingException if there are problems shutting down
      */
     void close() throws NamingException;
+
+    /**
+     * Checks to see if this BackingStore has been closed or shut down.
+     * Operations against closed BackingStores will fail.
+     *
+     * @return true if shut down, false otherwise
+     */
+    boolean isClosed();
 }
 
 

Modified: incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java
Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java?view=diff&rev=109774&p1=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java&r1=109773&p2=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java&r2=109774
==============================================================================
--- incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java	(original)
+++ incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java	Fri
Dec  3 21:28:11 2004
@@ -57,6 +57,9 @@
     /** Handle on the singleton instance of this class within the entire JVM. */
     private static RootNexus s_singleton = null;
     
+    /** the closed state of this partition */
+    private boolean closed = false;
+
     /** the system backend */
     private SystemPartition system;
     /** the backends keyed by normalized suffix strings */
@@ -101,7 +104,10 @@
             {
                 try
                 {
-                    RootNexus.this.close();
+                    if ( ! isClosed() )
+                    {
+                        RootNexus.this.close();
+                    }
                 }
                 catch ( NamingException e )
                 {
@@ -423,10 +429,24 @@
 
 
     /**
+     * @see ContextPartition#isClosed()
+     */
+    public boolean isClosed()
+    {
+        return closed;
+    }
+
+
+    /**
      * @see BackingStore#close()
      */
-    public void close() throws NamingException
+    public synchronized void close() throws NamingException
     {
+        if ( closed )
+        {
+            return;
+        }
+
         MultiException error = null;
         Iterator list = this.backends.values().iterator();
 
@@ -457,12 +477,14 @@
 
         s_singleton = null;
 
+        closed = true;
 
         if ( error != null )
         {
             NamingException total = new NamingException( "Encountered failures " 
                     + "while performing a close() operation on backing stores" );
             total.setRootCause( error );
+            throw total;
         }
     }
 

Modified: incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/Database.java
Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/Database.java?view=diff&rev=109774&p1=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/Database.java&r1=109773&p2=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/Database.java&r2=109774
==============================================================================
--- incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/Database.java	(original)
+++ incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/Database.java	Fri
Dec  3 21:28:11 2004
@@ -335,6 +335,14 @@
     void close() throws NamingException;
 
     /**
+     * Checks to see if this BackingStore has been closed or shut down.
+     * Operations against closed BackingStores will fail.
+     *
+     * @return true if shut down, false otherwise
+     */
+    boolean isClosed();
+
+    /**
      * TODO Document me!
      *
      * @param key TODO

Modified: incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/jdbm/JdbmDatabase.java
Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/jdbm/JdbmDatabase.java?view=diff&rev=109774&p1=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/jdbm/JdbmDatabase.java&r1=109773&p2=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/jdbm/JdbmDatabase.java&r2=109774
==============================================================================
--- incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/jdbm/JdbmDatabase.java
(original)
+++ incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/db/jdbm/JdbmDatabase.java
Fri Dec  3 21:28:11 2004
@@ -71,6 +71,9 @@
     /** a map of index names to system indices */
     private final Map sysIndices;
 
+    /** the closed state of this Database */
+    private boolean closed = false;
+
     /** the normalized distinguished name index */
     private Index ndnIdx;
     /** the user provided distinguished name index */
@@ -880,8 +883,13 @@
     /**
      * @see Database#close()
      */
-    public void close() throws NamingException
+    public synchronized void close() throws NamingException
     {
+        if ( closed )
+        {
+            return;
+        }
+
         ArrayList array = new ArrayList();
         array.addAll( indices.values() );
         
@@ -970,10 +978,11 @@
             rootCause.addThrowable( t );
         }
 
+        closed = true;
+
         if ( null != rootCause )
         {
-            NamingException ne = 
-                new NamingException( "Failed to close all" );
+            NamingException ne = new NamingException( "Failed to close all" );
             ne.setRootCause( rootCause );
             throw ne;
         }        
@@ -981,8 +990,16 @@
 
 
     /**
-     * @see Database#setProperty(String,
-     * String)
+     * @see Database#isClosed()
+     */
+    public boolean isClosed()
+    {
+        return closed;
+    }
+
+
+    /**
+     * @see Database#setProperty(String, String)
      */
     public void setProperty( String propertyName, String propertyValue )
         throws NamingException

Mime
View raw message