From 65f5cbe5687aa29943748eb5842c1c2f8989b122 Mon Sep 17 00:00:00 2001 From: javanna Date: Mon, 15 Feb 2016 14:41:43 +0100 Subject: [PATCH] remove boolean return type from resolveRequest and needless listener arg --- .../TransportInstanceSingleOperationAction.java | 14 ++++---------- .../action/update/TransportUpdateAction.java | 3 +-- ...ransportInstanceSingleOperationActionTests.java | 9 ++++----- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationAction.java b/core/src/main/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationAction.java index 53d797fbf8f..545016828d1 100644 --- a/core/src/main/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationAction.java +++ b/core/src/main/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationAction.java @@ -35,10 +35,8 @@ import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.ShardIterator; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.Nullable; -import org.elasticsearch.common.logging.LoggerMessageFormat; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.node.NodeClosedException; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportResponseHandler; @@ -91,11 +89,11 @@ public abstract class TransportInstanceSingleOperationAction listener); + protected abstract void resolveRequest(ClusterState state, Request request); protected boolean retryOnFailure(Throwable e) { return false; @@ -141,11 +139,7 @@ public abstract class TransportInstanceSingleOperationAction listener) { + protected void resolveRequest(ClusterState state, UpdateRequest request) { resolveAndValidateRouting(state.metaData(), request.concreteIndex(), request); - return true; } public static void resolveAndValidateRouting(MetaData metaData, String concreteIndex, UpdateRequest request) { diff --git a/core/src/test/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationActionTests.java b/core/src/test/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationActionTests.java index 2bfc12c0883..1dc03ac463d 100644 --- a/core/src/test/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationActionTests.java +++ b/core/src/test/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationActionTests.java @@ -108,8 +108,7 @@ public class TransportInstanceSingleOperationActionTests extends ESTestCase { } @Override - protected boolean resolveRequest(ClusterState state, Request request, ActionListener listener) { - return true; + protected void resolveRequest(ClusterState state, Request request) { } @Override @@ -290,13 +289,13 @@ public class TransportInstanceSingleOperationActionTests extends ESTestCase { Settings.EMPTY, "indices:admin/test_unresolvable", transportService, - new ActionFilters(new HashSet()), + new ActionFilters(new HashSet<>()), new MyResolver(), Request::new ) { @Override - protected boolean resolveRequest(ClusterState state, Request request, ActionListener listener) { - return false; + protected void resolveRequest(ClusterState state, Request request) { + throw new IllegalStateException("request cannot be resolved"); } }; Request request = new Request().index("test");