Internal: fix members visibility, remove unused constant and needless try catch in indexed scripts transport actions
This commit is contained in:
parent
151b1c47d4
commit
851cb3ae8a
|
@ -36,8 +36,8 @@ import org.elasticsearch.transport.TransportService;
|
|||
*/
|
||||
public class TransportDeleteIndexedScriptAction extends HandledTransportAction<DeleteIndexedScriptRequest, DeleteIndexedScriptResponse> {
|
||||
|
||||
private ScriptService scriptService;
|
||||
private Client client;
|
||||
private final ScriptService scriptService;
|
||||
private final Client client;
|
||||
|
||||
@Inject
|
||||
public TransportDeleteIndexedScriptAction(Settings settings, ThreadPool threadPool, ScriptService scriptService,
|
||||
|
|
|
@ -35,9 +35,8 @@ import org.elasticsearch.transport.TransportService;
|
|||
*/
|
||||
public class TransportGetIndexedScriptAction extends HandledTransportAction<GetIndexedScriptRequest, GetIndexedScriptResponse> {
|
||||
|
||||
public static final boolean REFRESH_FORCE = false;
|
||||
ScriptService scriptService;
|
||||
Client client;
|
||||
private final ScriptService scriptService;
|
||||
private final Client client;
|
||||
|
||||
@Inject
|
||||
public TransportGetIndexedScriptAction(Settings settings, ThreadPool threadPool, ScriptService scriptService,
|
||||
|
@ -54,11 +53,7 @@ public class TransportGetIndexedScriptAction extends HandledTransportAction<GetI
|
|||
|
||||
@Override
|
||||
public void doExecute(GetIndexedScriptRequest request, ActionListener<GetIndexedScriptResponse> listener){
|
||||
try {
|
||||
GetResponse scriptResponse = scriptService.queryScriptIndex(client, request.scriptLang(), request.id(), request.version(), request.versionType());
|
||||
listener.onResponse(new GetIndexedScriptResponse(scriptResponse));
|
||||
} catch(Throwable e){
|
||||
listener.onFailure(e);
|
||||
}
|
||||
GetResponse scriptResponse = scriptService.queryScriptIndex(client, request.scriptLang(), request.id(), request.version(), request.versionType());
|
||||
listener.onResponse(new GetIndexedScriptResponse(scriptResponse));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
package org.elasticsearch.action.indexedscripts.put;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.DelegatingActionListener;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -36,8 +36,8 @@ import org.elasticsearch.transport.TransportService;
|
|||
*/
|
||||
public class TransportPutIndexedScriptAction extends HandledTransportAction<PutIndexedScriptRequest, PutIndexedScriptResponse> {
|
||||
|
||||
private ScriptService scriptService;
|
||||
private Client client;
|
||||
private final ScriptService scriptService;
|
||||
private final Client client;
|
||||
|
||||
@Inject
|
||||
public TransportPutIndexedScriptAction(Settings settings, ThreadPool threadPool,
|
||||
|
@ -57,7 +57,7 @@ public class TransportPutIndexedScriptAction extends HandledTransportAction<PutI
|
|||
protected void doExecute(final PutIndexedScriptRequest request, final ActionListener<PutIndexedScriptResponse> listener) {
|
||||
scriptService.putScriptToIndex(client, request.safeSource(), request.scriptLang(), request.id(), null, request.opType().toString(), request.version(), request.versionType(), new DelegatingActionListener<IndexResponse,PutIndexedScriptResponse>(listener) {
|
||||
@Override
|
||||
public PutIndexedScriptResponse getDelegatedFromInstigator(IndexResponse indexResponse){
|
||||
public PutIndexedScriptResponse getDelegatedFromInstigator(IndexResponse indexResponse){
|
||||
return new PutIndexedScriptResponse(indexResponse.getType(),indexResponse.getId(),indexResponse.getVersion(),indexResponse.isCreated());
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue