Small cleanups in TransportClient et.al
Catching Throwable instead of Exception in TransportClient and TransportClientNodesService and restore interrupted flag if interrupt exception is caught and ignored
This commit is contained in:
parent
58ea539a26
commit
4b5935a708
|
@ -272,6 +272,7 @@ public class TransportClient extends AbstractClient {
|
|||
injector.getInstance(ThreadPool.class).awaitTermination(10, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
// ignore
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
try {
|
||||
injector.getInstance(ThreadPool.class).shutdownNow();
|
||||
|
|
|
@ -303,7 +303,7 @@ public class TransportClientNodesService extends AbstractComponent {
|
|||
if (!transportService.nodeConnected(node)) {
|
||||
try {
|
||||
transportService.connectToNode(node);
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
logger.debug("failed to connect to node [{}], removed from nodes list", e, node);
|
||||
continue;
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ public class TransportClientNodesService extends AbstractComponent {
|
|||
try {
|
||||
logger.trace("connecting to node [{}]", node);
|
||||
transportService.connectToNode(node);
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
it.remove();
|
||||
logger.debug("failed to connect to discovered node [" + node + "]", e);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.cluster.service;
|
|||
import org.elasticsearch.ElasticSearchException;
|
||||
import org.elasticsearch.ElasticSearchIllegalStateException;
|
||||
import org.elasticsearch.cluster.*;
|
||||
import org.elasticsearch.cluster.ClusterState.Builder;
|
||||
import org.elasticsearch.cluster.block.ClusterBlock;
|
||||
import org.elasticsearch.cluster.block.ClusterBlocks;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
|
@ -49,7 +50,6 @@ import java.util.List;
|
|||
import java.util.Queue;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import static org.elasticsearch.cluster.ClusterState.Builder;
|
||||
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
|
||||
import static org.elasticsearch.common.util.concurrent.EsExecutors.daemonThreadFactory;
|
||||
|
||||
|
@ -370,7 +370,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
|||
}
|
||||
try {
|
||||
transportService.connectToNode(node);
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
// the fault detection will detect it as failed as well
|
||||
logger.warn("failed to connect to node [" + node + "]", e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue