jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r802765 - /jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
Date Mon, 10 Aug 2009 12:37:44 GMT
Author: mreutegg
Date: Mon Aug 10 12:37:44 2009
New Revision: 802765

URL: http://svn.apache.org/viewvc?rev=802765&view=rev
Log:
JCR-2251: WorkspaceManager.dispose() should wait until change feed thread is stopped

Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?rev=802765&r1=802764&r2=802765&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
Mon Aug 10 12:37:44 2009
@@ -154,6 +154,11 @@
     private final Thread changeFeed;
 
     /**
+     * Flag that indicates that the changeFeed thread should be disposed.
+     */
+    private volatile boolean disposeChangeFeed = false;
+
+    /**
      * List of event listener that are set on this WorkspaceManager to get
      * notifications about local and external changes.
      */
@@ -592,7 +597,9 @@
         try {
             updateSync.acquire();
             if (changeFeed != null) {
+                disposeChangeFeed = true;
                 changeFeed.interrupt();
+                changeFeed.join();
             }
             hierarchyManager.dispose();
             if (subscription != null) {
@@ -1132,7 +1139,7 @@
         }
 
         public void run() {
-            while (!Thread.interrupted()) {
+            while (!Thread.interrupted() && !disposeChangeFeed) {
                 try {
                     InternalEventListener[] iel;
                     Subscription subscr;
@@ -1151,7 +1158,7 @@
                             sessionInfo.getWorkspaceName());
                     // check if thread had been interrupted while
                     // getting events
-                    if (Thread.interrupted()) {
+                    if (Thread.interrupted() || disposeChangeFeed) {
                         log.debug("Thread interrupted, terminating...");
                         break;
                     }



Mime
View raw message