Skip to content

Commit 4c493ac

Browse files
committed
Revert changes on *Request classes from issue
Relative to #2657
1 parent a646e12 commit 4c493ac

File tree

300 files changed

+2718
-2719
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+2718
-2719
lines changed

src/main/java/org/elasticsearch/action/ActionRequest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ protected ActionRequest(ActionRequest request) {
4949
* <p>When not executing on a thread, it will either be executed on the calling thread, or
5050
* on an expensive, IO based, thread.
5151
*/
52-
public final boolean isListenerThreaded() {
52+
public final boolean listenerThreaded() {
5353
return this.listenerThreaded;
5454
}
5555

5656
/**
5757
* Sets if the response listener be executed on a thread or not.
5858
*/
5959
@SuppressWarnings("unchecked")
60-
public final T setListenerThreaded(boolean listenerThreaded) {
60+
public final T listenerThreaded(boolean listenerThreaded) {
6161
this.listenerThreaded = listenerThreaded;
6262
return (T) this;
6363
}

src/main/java/org/elasticsearch/action/ActionRequestBuilder.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public Request request() {
4242

4343
@SuppressWarnings("unchecked")
4444
public final RequestBuilder setListenerThreaded(boolean listenerThreaded) {
45-
request.setListenerThreaded(listenerThreaded);
45+
request.listenerThreaded(listenerThreaded);
4646
return (RequestBuilder) this;
4747
}
4848

@@ -53,7 +53,7 @@ public final RequestBuilder putHeader(String key, Object value) {
5353
}
5454

5555
public ListenableActionFuture<Response> execute() {
56-
PlainListenableActionFuture<Response> future = new PlainListenableActionFuture<Response>(request.isListenerThreaded(), client.threadPool());
56+
PlainListenableActionFuture<Response> future = new PlainListenableActionFuture<Response>(request.listenerThreaded(), client.threadPool());
5757
execute(future);
5858
return future;
5959
}

src/main/java/org/elasticsearch/action/TransportActionNodeProxy.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public TransportActionNodeProxy(Settings settings, GenericAction<Request, Respon
5454

5555
public ActionFuture<Response> execute(DiscoveryNode node, Request request) throws ElasticSearchException {
5656
PlainActionFuture<Response> future = newFuture();
57-
request.setListenerThreaded(false);
57+
request.listenerThreaded(false);
5858
execute(node, request, future);
5959
return future;
6060
}
@@ -68,7 +68,7 @@ public Response newInstance() {
6868

6969
@Override
7070
public String executor() {
71-
if (request.isListenerThreaded()) {
71+
if (request.listenerThreaded()) {
7272
return ThreadPool.Names.GENERIC;
7373
}
7474
return ThreadPool.Names.SAME;

src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java

+20-20
Original file line numberDiff line numberDiff line change
@@ -57,84 +57,84 @@ public ClusterHealthRequest(String... indices) {
5757
this.indices = indices;
5858
}
5959

60-
public String[] getIndices() {
60+
public String[] indices() {
6161
return indices;
6262
}
6363

64-
public ClusterHealthRequest setIndices(String[] indices) {
64+
public ClusterHealthRequest indices(String[] indices) {
6565
this.indices = indices;
6666
return this;
6767
}
6868

69-
public TimeValue getTimeout() {
69+
public TimeValue timeout() {
7070
return timeout;
7171
}
7272

73-
public ClusterHealthRequest setTimeout(TimeValue timeout) {
73+
public ClusterHealthRequest timeout(TimeValue timeout) {
7474
this.timeout = timeout;
7575
if (masterNodeTimeout == DEFAULT_MASTER_NODE_TIMEOUT) {
7676
masterNodeTimeout = timeout;
7777
}
7878
return this;
7979
}
8080

81-
public ClusterHealthRequest setTimeout(String timeout) {
82-
return setTimeout(TimeValue.parseTimeValue(timeout, null));
81+
public ClusterHealthRequest timeout(String timeout) {
82+
return this.timeout(TimeValue.parseTimeValue(timeout, null));
8383
}
8484

85-
public ClusterHealthStatus getWaitForStatus() {
85+
public ClusterHealthStatus waitForStatus() {
8686
return waitForStatus;
8787
}
8888

89-
public ClusterHealthRequest setWaitForStatus(ClusterHealthStatus waitForStatus) {
89+
public ClusterHealthRequest waitForStatus(ClusterHealthStatus waitForStatus) {
9090
this.waitForStatus = waitForStatus;
9191
return this;
9292
}
9393

94-
public ClusterHealthRequest setWaitForGreenStatus() {
95-
return setWaitForStatus(ClusterHealthStatus.GREEN);
94+
public ClusterHealthRequest waitForGreenStatus() {
95+
return waitForStatus(ClusterHealthStatus.GREEN);
9696
}
9797

98-
public ClusterHealthRequest setWaitForYellowStatus() {
99-
return setWaitForStatus(ClusterHealthStatus.YELLOW);
98+
public ClusterHealthRequest waitForYellowStatus() {
99+
return waitForStatus(ClusterHealthStatus.YELLOW);
100100
}
101101

102-
public int getWaitForRelocatingShards() {
102+
public int waitForRelocatingShards() {
103103
return waitForRelocatingShards;
104104
}
105105

106-
public ClusterHealthRequest setWaitForRelocatingShards(int waitForRelocatingShards) {
106+
public ClusterHealthRequest waitForRelocatingShards(int waitForRelocatingShards) {
107107
this.waitForRelocatingShards = waitForRelocatingShards;
108108
return this;
109109
}
110110

111-
public int getWaitForActiveShards() {
111+
public int waitForActiveShards() {
112112
return waitForActiveShards;
113113
}
114114

115-
public ClusterHealthRequest setWaitForActiveShards(int waitForActiveShards) {
115+
public ClusterHealthRequest waitForActiveShards(int waitForActiveShards) {
116116
this.waitForActiveShards = waitForActiveShards;
117117
return this;
118118
}
119119

120-
public String getWaitForNodes() {
120+
public String waitForNodes() {
121121
return waitForNodes;
122122
}
123123

124124
/**
125125
* Waits for N number of nodes. Use "12" for exact mapping, ">12" and "<12" for range.
126126
*/
127-
public ClusterHealthRequest setWaitForNodes(String waitForNodes) {
127+
public ClusterHealthRequest waitForNodes(String waitForNodes) {
128128
this.waitForNodes = waitForNodes;
129129
return this;
130130
}
131131

132-
public ClusterHealthRequest setLocal(boolean local) {
132+
public ClusterHealthRequest local(boolean local) {
133133
this.local = local;
134134
return this;
135135
}
136136

137-
public boolean isLocal() {
137+
public boolean local() {
138138
return this.local;
139139
}
140140

src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestBuilder.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,50 +35,50 @@ public ClusterHealthRequestBuilder(ClusterAdminClient clusterClient) {
3535
}
3636

3737
public ClusterHealthRequestBuilder setIndices(String... indices) {
38-
request.setIndices(indices);
38+
request.indices(indices);
3939
return this;
4040
}
4141

4242
public ClusterHealthRequestBuilder setTimeout(TimeValue timeout) {
43-
request.setTimeout(timeout);
43+
request.timeout(timeout);
4444
return this;
4545
}
4646

4747
public ClusterHealthRequestBuilder setTimeout(String timeout) {
48-
request.setTimeout(timeout);
48+
request.timeout(timeout);
4949
return this;
5050
}
5151

5252
public ClusterHealthRequestBuilder setWaitForStatus(ClusterHealthStatus waitForStatus) {
53-
request.setWaitForStatus(waitForStatus);
53+
request.waitForStatus(waitForStatus);
5454
return this;
5555
}
5656

5757
public ClusterHealthRequestBuilder setWaitForGreenStatus() {
58-
request.setWaitForGreenStatus();
58+
request.waitForGreenStatus();
5959
return this;
6060
}
6161

6262
public ClusterHealthRequestBuilder setWaitForYellowStatus() {
63-
request.setWaitForYellowStatus();
63+
request.waitForYellowStatus();
6464
return this;
6565
}
6666

6767
public ClusterHealthRequestBuilder setWaitForRelocatingShards(int waitForRelocatingShards) {
68-
request.setWaitForRelocatingShards(waitForRelocatingShards);
68+
request.waitForRelocatingShards(waitForRelocatingShards);
6969
return this;
7070
}
7171

7272
public ClusterHealthRequestBuilder setWaitForActiveShards(int waitForActiveShards) {
73-
request.setWaitForActiveShards(waitForActiveShards);
73+
request.waitForActiveShards(waitForActiveShards);
7474
return this;
7575
}
7676

7777
/**
7878
* Waits for N number of nodes. Use "12" for exact mapping, ">12" and "<12" for range.
7979
*/
8080
public ClusterHealthRequestBuilder setWaitForNodes(String waitForNodes) {
81-
request.setWaitForNodes(waitForNodes);
81+
request.waitForNodes(waitForNodes);
8282
return this;
8383
}
8484

src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java

+30-30
Original file line numberDiff line numberDiff line change
@@ -73,92 +73,92 @@ protected ClusterHealthResponse newResponse() {
7373
@Override
7474
protected ClusterHealthResponse masterOperation(ClusterHealthRequest request, ClusterState unusedState) throws ElasticSearchException {
7575
int waitFor = 5;
76-
if (request.getWaitForStatus() == null) {
76+
if (request.waitForStatus() == null) {
7777
waitFor--;
7878
}
79-
if (request.getWaitForRelocatingShards() == -1) {
79+
if (request.waitForRelocatingShards() == -1) {
8080
waitFor--;
8181
}
82-
if (request.getWaitForActiveShards() == -1) {
82+
if (request.waitForActiveShards() == -1) {
8383
waitFor--;
8484
}
85-
if (request.getWaitForNodes().isEmpty()) {
85+
if (request.waitForNodes().isEmpty()) {
8686
waitFor--;
8787
}
88-
if (request.getIndices().length == 0) { // check that they actually exists in the meta data
88+
if (request.indices().length == 0) { // check that they actually exists in the meta data
8989
waitFor--;
9090
}
9191
if (waitFor == 0) {
9292
// no need to wait for anything
9393
ClusterState clusterState = clusterService.state();
9494
return clusterHealth(request, clusterState);
9595
}
96-
long endTime = System.currentTimeMillis() + request.getTimeout().millis();
96+
long endTime = System.currentTimeMillis() + request.timeout().millis();
9797
while (true) {
9898
int waitForCounter = 0;
9999
ClusterState clusterState = clusterService.state();
100100
ClusterHealthResponse response = clusterHealth(request, clusterState);
101-
if (request.getWaitForStatus() != null && response.getStatus().value() <= request.getWaitForStatus().value()) {
101+
if (request.waitForStatus() != null && response.getStatus().value() <= request.waitForStatus().value()) {
102102
waitForCounter++;
103103
}
104-
if (request.getWaitForRelocatingShards() != -1 && response.getRelocatingShards() <= request.getWaitForRelocatingShards()) {
104+
if (request.waitForRelocatingShards() != -1 && response.getRelocatingShards() <= request.waitForRelocatingShards()) {
105105
waitForCounter++;
106106
}
107-
if (request.getWaitForActiveShards() != -1 && response.getActiveShards() >= request.getWaitForActiveShards()) {
107+
if (request.waitForActiveShards() != -1 && response.getActiveShards() >= request.waitForActiveShards()) {
108108
waitForCounter++;
109109
}
110-
if (request.getIndices().length > 0) {
110+
if (request.indices().length > 0) {
111111
try {
112-
clusterState.metaData().concreteIndices(request.getIndices());
112+
clusterState.metaData().concreteIndices(request.indices());
113113
waitForCounter++;
114114
} catch (IndexMissingException e) {
115115
response.status = ClusterHealthStatus.RED; // no indices, make sure its RED
116116
// missing indices, wait a bit more...
117117
}
118118
}
119-
if (!request.getWaitForNodes().isEmpty()) {
120-
if (request.getWaitForNodes().startsWith(">=")) {
121-
int expected = Integer.parseInt(request.getWaitForNodes().substring(2));
119+
if (!request.waitForNodes().isEmpty()) {
120+
if (request.waitForNodes().startsWith(">=")) {
121+
int expected = Integer.parseInt(request.waitForNodes().substring(2));
122122
if (response.getNumberOfNodes() >= expected) {
123123
waitForCounter++;
124124
}
125-
} else if (request.getWaitForNodes().startsWith("ge(")) {
126-
int expected = Integer.parseInt(request.getWaitForNodes().substring(3, request.getWaitForNodes().length() - 1));
125+
} else if (request.waitForNodes().startsWith("ge(")) {
126+
int expected = Integer.parseInt(request.waitForNodes().substring(3, request.waitForNodes().length() - 1));
127127
if (response.getNumberOfNodes() >= expected) {
128128
waitForCounter++;
129129
}
130-
} else if (request.getWaitForNodes().startsWith("<=")) {
131-
int expected = Integer.parseInt(request.getWaitForNodes().substring(2));
130+
} else if (request.waitForNodes().startsWith("<=")) {
131+
int expected = Integer.parseInt(request.waitForNodes().substring(2));
132132
if (response.getNumberOfNodes() <= expected) {
133133
waitForCounter++;
134134
}
135-
} else if (request.getWaitForNodes().startsWith("le(")) {
136-
int expected = Integer.parseInt(request.getWaitForNodes().substring(3, request.getWaitForNodes().length() - 1));
135+
} else if (request.waitForNodes().startsWith("le(")) {
136+
int expected = Integer.parseInt(request.waitForNodes().substring(3, request.waitForNodes().length() - 1));
137137
if (response.getNumberOfNodes() <= expected) {
138138
waitForCounter++;
139139
}
140-
} else if (request.getWaitForNodes().startsWith(">")) {
141-
int expected = Integer.parseInt(request.getWaitForNodes().substring(1));
140+
} else if (request.waitForNodes().startsWith(">")) {
141+
int expected = Integer.parseInt(request.waitForNodes().substring(1));
142142
if (response.getNumberOfNodes() > expected) {
143143
waitForCounter++;
144144
}
145-
} else if (request.getWaitForNodes().startsWith("gt(")) {
146-
int expected = Integer.parseInt(request.getWaitForNodes().substring(3, request.getWaitForNodes().length() - 1));
145+
} else if (request.waitForNodes().startsWith("gt(")) {
146+
int expected = Integer.parseInt(request.waitForNodes().substring(3, request.waitForNodes().length() - 1));
147147
if (response.getNumberOfNodes() > expected) {
148148
waitForCounter++;
149149
}
150-
} else if (request.getWaitForNodes().startsWith("<")) {
151-
int expected = Integer.parseInt(request.getWaitForNodes().substring(1));
150+
} else if (request.waitForNodes().startsWith("<")) {
151+
int expected = Integer.parseInt(request.waitForNodes().substring(1));
152152
if (response.getNumberOfNodes() < expected) {
153153
waitForCounter++;
154154
}
155-
} else if (request.getWaitForNodes().startsWith("lt(")) {
156-
int expected = Integer.parseInt(request.getWaitForNodes().substring(3, request.getWaitForNodes().length() - 1));
155+
} else if (request.waitForNodes().startsWith("lt(")) {
156+
int expected = Integer.parseInt(request.waitForNodes().substring(3, request.waitForNodes().length() - 1));
157157
if (response.getNumberOfNodes() < expected) {
158158
waitForCounter++;
159159
}
160160
} else {
161-
int expected = Integer.parseInt(request.getWaitForNodes());
161+
int expected = Integer.parseInt(request.waitForNodes());
162162
if (response.getNumberOfNodes() == expected) {
163163
waitForCounter++;
164164
}
@@ -190,7 +190,7 @@ private ClusterHealthResponse clusterHealth(ClusterHealthRequest request, Cluste
190190
response.numberOfNodes = clusterState.nodes().size();
191191
response.numberOfDataNodes = clusterState.nodes().dataNodes().size();
192192

193-
for (String index : clusterState.metaData().concreteIndicesIgnoreMissing(request.getIndices())) {
193+
for (String index : clusterState.metaData().concreteIndicesIgnoreMissing(request.indices())) {
194194
IndexRoutingTable indexRoutingTable = clusterState.routingTable().index(index);
195195
IndexMetaData indexMetaData = clusterState.metaData().index(index);
196196
if (indexRoutingTable == null) {

src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/NodesHotThreadsRequest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -44,38 +44,38 @@ public NodesHotThreadsRequest(String... nodesIds) {
4444
super(nodesIds);
4545
}
4646

47-
public int getThreads() {
47+
public int threads() {
4848
return this.threads;
4949
}
5050

51-
public NodesHotThreadsRequest setThreads(int threads) {
51+
public NodesHotThreadsRequest threads(int threads) {
5252
this.threads = threads;
5353
return this;
5454
}
5555

56-
public NodesHotThreadsRequest setType(String type) {
56+
public NodesHotThreadsRequest type(String type) {
5757
this.type = type;
5858
return this;
5959
}
6060

61-
public String getType() {
61+
public String type() {
6262
return this.type;
6363
}
6464

65-
public NodesHotThreadsRequest setInterval(TimeValue interval) {
65+
public NodesHotThreadsRequest interval(TimeValue interval) {
6666
this.interval = interval;
6767
return this;
6868
}
6969

70-
public TimeValue getInterval() {
70+
public TimeValue interval() {
7171
return this.interval;
7272
}
7373

74-
public int getSnapshots() {
74+
public int snapshots() {
7575
return this.snapshots;
7676
}
7777

78-
public NodesHotThreadsRequest setSnapshots(int snapshots) {
78+
public NodesHotThreadsRequest snapshots(int snapshots) {
7979
this.snapshots = snapshots;
8080
return this;
8181
}

0 commit comments

Comments
 (0)