svn commit: r717978 - in /xml/xindice/trunk: java/src/org/apache/xindice/core/Database.java status.xml

[email protected]
Newsgroups gmane.text.xml.xindice.devel
Message-ID <[email protected]>
Author: vgritsenko
Date: Sat Nov 15 20:40:08 2008
New Revision: 717978

URL: http://svn.apache.org/viewvc?rev=717978&view=rev
Log:
Fix bug #46218: race condition in shutdown sequence

Modified:
    xml/xindice/trunk/java/src/org/apache/xindice/core/Database.java
    xml/xindice/trunk/status.xml

Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/Database.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/Database.java?rev=717978&r1=717977&r2=717978&view=diff
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/Database.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/Database.java Sat Nov 15 20:40:08 2008
@@ -177,38 +177,40 @@
      * @return true if closed
      * @throws DBException if unable to close
      */
-    protected synchronized boolean close(boolean removeFromShutdown) throws DBException {
+    protected boolean close(boolean removeFromShutdown) throws DBException {
         if (removeFromShutdown) {
             // we have already been closed so no need to do this again.
             shutdownHandler.removeDatabase(this);
         }
 
-        // check to see if we have already been closed.
-        if (!closed) {
-            if(log.isDebugEnabled()) {
-                log.debug("Shutting down database: '" + getName() + "'");
-            }
+        synchronized (databases) {
+            databases.remove(getName());
+        }
 
-            flushConfig();
-            super.close();
+        synchronized (this) {
+            // check to see if we have already been closed.
+            if (!closed) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Shutting down database: '" + getName() + "'");
+                }
 
-            // Release database lock
-            try {
-                this.lock.close();
-                new File(getCollectionRoot(), "db.lock").delete();
-            } catch (Exception e) {
-                // Ignore IO exception
-            }
-            this.lock = null;
+                flushConfig();
+                super.close();
 
-            synchronized (databases) {
-                databases.remove(getName());
-            }
+                // Release database lock
+                try {
+                    this.lock.close();
+                    new File(getCollectionRoot(), "db.lock").delete();
+                } catch (Exception e) {
+                    // Ignore IO exception
+                }
+                this.lock = null;
 
-            // Stop the timer thread
-            timer.cancel();
+                // Stop the timer thread
+                timer.cancel();
 
-            closed = true;
+                closed = true;
+            }
         }
 
         return true;

Modified: xml/xindice/trunk/status.xml
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/status.xml?rev=717978&r1=717977&r2=717978&view=diff
==============================================================================
--- xml/xindice/trunk/status.xml (original)
+++ xml/xindice/trunk/status.xml Sat Nov 15 20:40:08 2008
@@ -103,6 +103,9 @@
 
   <changes>
     <release version="1.2-dev" date="unreleased">
+      <action dev="VG" type="fix" fixes-bug="46218">
+        Fixed race condition in shutdown sequence.
+      </action>
       <action dev="VG" type="update">
         Optimized transmission of collection's symbol table between server and
         the client for reduced traffic and better performance.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.