From 76465ec37a959f7ba3a4b658efbf8c0f49145c87 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Sun, 14 Feb 2016 21:13:20 +0100 Subject: [PATCH] don't through fail to send exception on a the generic thread - it may be shut down already and will an exception --- .../TransportReplicationAction.java | 60 +++++++++---------- .../action/shard/ShardStateAction.java | 4 +- .../transport/TransportService.java | 27 ++++----- 3 files changed, 45 insertions(+), 46 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java b/core/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java index 5608d40ede1..0ac2ab58520 100644 --- a/core/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java +++ b/core/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java @@ -52,7 +52,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; -import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.index.IndexService; import org.elasticsearch.index.engine.VersionConflictEngineException; @@ -68,6 +67,7 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportResponseHandler; import org.elasticsearch.transport.ConnectTransportException; import org.elasticsearch.transport.EmptyTransportResponseHandler; +import org.elasticsearch.transport.SendRequestTransportException; import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportChannelResponseHandler; import org.elasticsearch.transport.TransportException; @@ -1018,38 +1018,36 @@ public abstract class TransportReplicationAction tracelLogExclude) { this.tracelLogExclude = tracelLogExclude.toArray(Strings.EMPTY_ARRAY); } + @Override protected void doStart() { adapter.rxMetric.clear(); @@ -326,12 +327,7 @@ public class TransportService extends AbstractLifecycleComponent void registerRequestHandler(String action, Supplier requestFactory, String executor, TransportRequestHandler handler) { RequestHandlerRegistry reg = new RequestHandlerRegistry<>(action, requestFactory, taskManager, handler, executor, false); @@ -417,11 +414,12 @@ public class TransportService extends AbstractLifecycleComponent void registerRequestHandler(String action, Supplier request, String executor, boolean forceExecution, TransportRequestHandler handler) { RequestHandlerRegistry reg = new RequestHandlerRegistry<>(action, request, taskManager, handler, executor, forceExecution); @@ -729,6 +727,7 @@ public class TransportService extends AbstractLifecycleComponent implements TransportResponseHandler { private final TransportResponseHandler delegate; private final ThreadContext.StoredContext threadContext; + private ContextRestoreResponseHandler(ThreadContext.StoredContext threadContext, TransportResponseHandler delegate) { this.delegate = delegate; this.threadContext = threadContext; @@ -766,7 +765,7 @@ public class TransportService extends AbstractLifecycleComponent