mirror of https://github.com/apache/lucene.git
SOLR-4554: There are some test fails because of a wait loop that causes lingering threads.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1454932 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a60156aae3
commit
a0ef70931c
|
@ -581,12 +581,26 @@ public class Overseer {
|
|||
public void close() {
|
||||
isClosed = true;
|
||||
if (updaterThread != null) {
|
||||
try {
|
||||
updaterThread.close();
|
||||
updaterThread.interrupt();
|
||||
} catch (Throwable t) {
|
||||
log.error("Error closing updaterThread", t);
|
||||
}
|
||||
}
|
||||
if (ccThread != null) {
|
||||
try {
|
||||
ccThread.close();
|
||||
ccThread.interrupt();
|
||||
} catch (Throwable t) {
|
||||
log.error("Error closing ccThread", t);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
reader.close();
|
||||
} catch (Throwable t) {
|
||||
log.error("Error closing zkStateReader", t);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -348,6 +348,12 @@ public final class ZkController {
|
|||
log.error("Error closing overseer", t);
|
||||
}
|
||||
|
||||
try {
|
||||
zkStateReader.close();
|
||||
} catch(Throwable t) {
|
||||
log.error("Error closing zkStateReader", t);
|
||||
}
|
||||
|
||||
try {
|
||||
zkClient.close();;
|
||||
} catch(Throwable t) {
|
||||
|
|
|
@ -284,6 +284,10 @@ public class LeaderElectionIntegrationTest extends SolrTestCaseJ4 {
|
|||
zkClient.close();
|
||||
}
|
||||
|
||||
if (reader != null) {
|
||||
reader.close();
|
||||
}
|
||||
|
||||
for (CoreContainer cc : containerMap.values()) {
|
||||
if (!cc.isShutDown()) {
|
||||
cc.shutdown();
|
||||
|
|
|
@ -451,6 +451,7 @@ public class LeaderElectionTest extends SolrTestCaseJ4 {
|
|||
@Override
|
||||
public void tearDown() throws Exception {
|
||||
zkClient.close();
|
||||
zkStateReader.close();
|
||||
server.shutdown();
|
||||
super.tearDown();
|
||||
}
|
||||
|
|
|
@ -133,6 +133,8 @@ public class ZkStateReader {
|
|||
|
||||
private Aliases aliases = new Aliases();
|
||||
|
||||
private volatile boolean closed = false;
|
||||
|
||||
public ZkStateReader(SolrZkClient zkClient) {
|
||||
this.zkClient = zkClient;
|
||||
initZkCmdExecutor(zkClient.getZkClientTimeout());
|
||||
|
@ -437,6 +439,7 @@ public class ZkStateReader {
|
|||
}
|
||||
|
||||
public void close() {
|
||||
this.closed = true;
|
||||
if (closeClient) {
|
||||
zkClient.close();
|
||||
}
|
||||
|
@ -469,7 +472,7 @@ public class ZkStateReader {
|
|||
*/
|
||||
public Replica getLeaderRetry(String collection, String shard, int timeout) throws InterruptedException {
|
||||
long timeoutAt = System.currentTimeMillis() + timeout;
|
||||
while (System.currentTimeMillis() < timeoutAt) {
|
||||
while (System.currentTimeMillis() < timeoutAt && !closed) {
|
||||
if (clusterState != null) {
|
||||
Replica replica = clusterState.getLeader(collection, shard);
|
||||
if (replica != null && getClusterState().liveNodesContain(replica.getNodeName())) {
|
||||
|
|
|
@ -85,7 +85,7 @@ public class CloudSolrServerTest extends AbstractFullDistribZkTestBase {
|
|||
public CloudSolrServerTest() {
|
||||
super();
|
||||
sliceCount = 2;
|
||||
shardCount = 6;
|
||||
shardCount = 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue