lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1234154 - in /lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr: cloud/RecoveryStrategy.java update/DefaultSolrCoreState.java
Date Fri, 20 Jan 2012 21:41:46 GMT
Author: markrmiller
Date: Fri Jan 20 21:41:45 2012
New Revision: 1234154

URL: http://svn.apache.org/viewvc?rev=1234154&view=rev
Log:
back to always waiting for cancled recovery, but move a cancel call out of sync block

Modified:
    lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
    lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java

Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java?rev=1234154&r1=1234153&r2=1234154&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
(original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
Fri Jan 20 21:41:45 2012
@@ -64,7 +64,6 @@ public class RecoveryStrategy extends Th
   public RecoveryStrategy(SolrCore core) {
     this.core = core;
     this.coreName = core.getName();
-    setDaemon(true);
     
     zkController = core.getCoreDescriptor().getCoreContainer().getZkController();
     zkStateReader = zkController.getZkStateReader();

Modified: lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java?rev=1234154&r1=1234153&r2=1234154&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
(original)
+++ lucene/dev/branches/solrcloud/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
Fri Jan 20 21:41:45 2012
@@ -57,18 +57,23 @@ public final class DefaultSolrCoreState 
   }
 
   @Override
-  public synchronized void decref(IndexWriterCloser closer) throws IOException {
-    refCnt--;
-    if (refCnt == 0) {
-      if (closer != null) {
-        closer.closeWriter(indexWriter);
-      } else if (indexWriter != null) {
-        indexWriter.close();
+  public  void decref(IndexWriterCloser closer) throws IOException {
+    boolean cancelRecovery = false;
+    synchronized (this) {
+      refCnt--;
+      if (refCnt == 0) {
+        if (closer != null) {
+          closer.closeWriter(indexWriter);
+        } else if (indexWriter != null) {
+          indexWriter.close();
+        }
+        directoryFactory.close();
+        closed = true;
+        cancelRecovery = true;
       }
-      directoryFactory.close();
-      closed  = true;
-      cancelRecovery();
     }
+    // don't wait for this in the sync block
+    if (cancelRecovery) cancelRecovery();
   }
 
   @Override
@@ -122,11 +127,13 @@ public final class DefaultSolrCoreState 
     synchronized (recoveryLock) {
       if (recoveryStrat != null) {
         recoveryStrat.close();
+        
         try {
           recoveryStrat.join();
         } catch (InterruptedException e) {
           
         }
+        
         recoveryRunning = false;
         recoveryLock.notifyAll();
       }



Mime
View raw message