You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2012/01/31 16:58:18 UTC

svn commit: r1238680 - in /lucene/dev/trunk/solr: core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java

Author: markrmiller
Date: Tue Jan 31 15:58:18 2012
New Revision: 1238680

URL: http://svn.apache.org/viewvc?rev=1238680&view=rev
Log:
allow for over closing SolrZkClient as we do with SolrCore

Modified:
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java?rev=1238680&r1=1238679&r2=1238680&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java Tue Jan 31 15:58:18 2012
@@ -243,9 +243,8 @@ public class CloudStateUpdateTest extend
     }
     container1.shutdown();
     container2.shutdown();
-    if (!container3.isShutDown()) {
-      container3.shutdown();
-    }
+    container3.shutdown();
+
     zkServer.shutdown();
     super.tearDown();
     System.clearProperty("zkClientTimeout");

Modified: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java?rev=1238680&r1=1238679&r2=1238680&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java (original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java Tue Jan 31 15:58:18 2012
@@ -491,6 +491,15 @@ public class SolrZkClient {
             keeper.create(currentPath, bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, mode);
           }
         } catch (NodeExistsException e) {
+          
+          if (!failOnExists) {
+            // TODO: version ? for now, don't worry about race
+            setData(currentPath, data, -1, retryOnConnLoss);
+            // set new watch
+            exists(currentPath, watcher, retryOnConnLoss);
+            return;
+          }
+          
           // ignore unless it's the last node in the path
           if (i == paths.length - 1) {
             throw e;
@@ -643,6 +652,7 @@ public class SolrZkClient {
    * @throws InterruptedException
    */
   public void close() throws InterruptedException {
+    if (isClosed) return; // it's okay if we over close - same as solrcore
     isClosed = true;
     keeper.close();
     numCloses.incrementAndGet();