allow for over closing SolrZkClient as we do with SolrCore

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1238680 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-01-31 15:58:18 +00:00
parent cf538e6f74
commit 0d8d2f48e4
2 changed files with 12 additions and 3 deletions

View File

@ -243,9 +243,8 @@ public class CloudStateUpdateTest extends SolrTestCaseJ4 {
}
container1.shutdown();
container2.shutdown();
if (!container3.isShutDown()) {
container3.shutdown();
}
container3.shutdown();
zkServer.shutdown();
super.tearDown();
System.clearProperty("zkClientTimeout");

View File

@ -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();