10
10
import org .elasticsearch .action .support .TransportAction ;
11
11
import org .elasticsearch .client .ElasticsearchClient ;
12
12
import org .elasticsearch .client .node .NodeClient ;
13
- import org .elasticsearch .cluster .metadata .IndexNameExpressionResolver ;
14
13
import org .elasticsearch .common .inject .Inject ;
15
14
import org .elasticsearch .common .io .stream .StreamInput ;
16
15
import org .elasticsearch .common .io .stream .StreamOutput ;
23
22
import org .elasticsearch .rest .RestRequest ;
24
23
import org .elasticsearch .rest .RestRequest .Method ;
25
24
import org .elasticsearch .rest .RestStatus ;
25
+ import org .elasticsearch .tasks .Task ;
26
26
import org .elasticsearch .threadpool .ThreadPool ;
27
27
import org .elasticsearch .transport .TransportChannel ;
28
28
import org .elasticsearch .transport .TransportRequestHandler ;
38
38
/**
39
39
* List all available clustering algorithms.
40
40
*/
41
- public class ListAlgorithmsAction extends Action <ListAlgorithmsAction .ListAlgorithmsActionRequest ,
42
- ListAlgorithmsAction .ListAlgorithmsActionResponse ,
43
- ListAlgorithmsAction .ListAlgorithmsActionRequestBuilder > {
41
+ public class ListAlgorithmsAction extends Action <ListAlgorithmsAction .ListAlgorithmsActionResponse > {
44
42
/* Action name. */
45
43
public static final String NAME = "cluster:monitor/carrot2/algorithms" ;
46
44
@@ -56,11 +54,6 @@ public ListAlgorithmsActionResponse newResponse() {
56
54
return new ListAlgorithmsActionResponse ();
57
55
}
58
56
59
- @ Override
60
- public ListAlgorithmsActionRequestBuilder newRequestBuilder (ElasticsearchClient client ) {
61
- return new ListAlgorithmsActionRequestBuilder (client );
62
- }
63
-
64
57
/**
65
58
* An {@link ActionRequest} for {@link ListAlgorithmsAction}.
66
59
*/
@@ -77,8 +70,7 @@ public ActionRequestValidationException validate() {
77
70
*/
78
71
public static class ListAlgorithmsActionRequestBuilder
79
72
extends ActionRequestBuilder <ListAlgorithmsActionRequest ,
80
- ListAlgorithmsActionResponse ,
81
- ListAlgorithmsActionRequestBuilder > {
73
+ ListAlgorithmsActionResponse > {
82
74
public ListAlgorithmsActionRequestBuilder (ElasticsearchClient client ) {
83
75
super (client , ListAlgorithmsAction .INSTANCE , new ListAlgorithmsActionRequest ());
84
76
}
@@ -144,22 +136,16 @@ public String toString() {
144
136
* {@link ListAlgorithmsActionResponse}.
145
137
*/
146
138
public static class TransportListAlgorithmsAction
147
- extends TransportAction <ListAlgorithmsActionRequest ,
148
- ListAlgorithmsActionResponse > {
139
+ extends TransportAction <ListAlgorithmsActionRequest , ListAlgorithmsActionResponse > {
149
140
150
141
private final ControllerSingleton controllerSingleton ;
151
142
152
143
@ Inject
153
- public TransportListAlgorithmsAction (Settings settings , ThreadPool threadPool ,
154
- TransportService transportService ,
144
+ public TransportListAlgorithmsAction (TransportService transportService ,
155
145
ControllerSingleton controllerSingleton ,
156
- ActionFilters actionFilters ,
157
- IndexNameExpressionResolver indexNameExpressionResolver ) {
158
- super (settings ,
159
- ListAlgorithmsAction .NAME ,
160
- threadPool ,
146
+ ActionFilters actionFilters ) {
147
+ super (ListAlgorithmsAction .NAME ,
161
148
actionFilters ,
162
- indexNameExpressionResolver ,
163
149
transportService .getTaskManager ());
164
150
this .controllerSingleton = controllerSingleton ;
165
151
transportService .registerRequestHandler (
@@ -170,15 +156,17 @@ public TransportListAlgorithmsAction(Settings settings, ThreadPool threadPool,
170
156
}
171
157
172
158
@ Override
173
- protected void doExecute (ListAlgorithmsActionRequest request ,
159
+ protected void doExecute (Task task ,
160
+ ListAlgorithmsActionRequest request ,
174
161
ActionListener <ListAlgorithmsActionResponse > listener ) {
175
162
listener .onResponse (new ListAlgorithmsActionResponse (controllerSingleton .getAlgorithms ()));
176
163
}
177
164
178
165
private final class TransportHandler implements TransportRequestHandler <ListAlgorithmsActionRequest > {
179
166
@ Override
180
167
public void messageReceived (final ListAlgorithmsActionRequest request ,
181
- final TransportChannel channel ) throws Exception {
168
+ final TransportChannel channel ,
169
+ Task task ) throws Exception {
182
170
execute (request , new ActionListener <ListAlgorithmsActionResponse >() {
183
171
@ Override
184
172
public void onResponse (ListAlgorithmsActionResponse response ) {
0 commit comments