Internal: fix members visibility, remove unused constant and needless try catch in indexed scripts transport actions

This commit is contained in:
javanna 2014-09-03 11:55:42 +02:00 committed by Luca Cavanna
parent 151b1c47d4
commit 851cb3ae8a
3 changed files with 10 additions and 15 deletions

View File

@ -36,8 +36,8 @@ import org.elasticsearch.transport.TransportService;
*/ */
public class TransportDeleteIndexedScriptAction extends HandledTransportAction<DeleteIndexedScriptRequest, DeleteIndexedScriptResponse> { public class TransportDeleteIndexedScriptAction extends HandledTransportAction<DeleteIndexedScriptRequest, DeleteIndexedScriptResponse> {
private ScriptService scriptService; private final ScriptService scriptService;
private Client client; private final Client client;
@Inject @Inject
public TransportDeleteIndexedScriptAction(Settings settings, ThreadPool threadPool, ScriptService scriptService, public TransportDeleteIndexedScriptAction(Settings settings, ThreadPool threadPool, ScriptService scriptService,

View File

@ -35,9 +35,8 @@ import org.elasticsearch.transport.TransportService;
*/ */
public class TransportGetIndexedScriptAction extends HandledTransportAction<GetIndexedScriptRequest, GetIndexedScriptResponse> { public class TransportGetIndexedScriptAction extends HandledTransportAction<GetIndexedScriptRequest, GetIndexedScriptResponse> {
public static final boolean REFRESH_FORCE = false; private final ScriptService scriptService;
ScriptService scriptService; private final Client client;
Client client;
@Inject @Inject
public TransportGetIndexedScriptAction(Settings settings, ThreadPool threadPool, ScriptService scriptService, public TransportGetIndexedScriptAction(Settings settings, ThreadPool threadPool, ScriptService scriptService,
@ -54,11 +53,7 @@ public class TransportGetIndexedScriptAction extends HandledTransportAction<GetI
@Override @Override
public void doExecute(GetIndexedScriptRequest request, ActionListener<GetIndexedScriptResponse> listener){ public void doExecute(GetIndexedScriptRequest request, ActionListener<GetIndexedScriptResponse> listener){
try { GetResponse scriptResponse = scriptService.queryScriptIndex(client, request.scriptLang(), request.id(), request.version(), request.versionType());
GetResponse scriptResponse = scriptService.queryScriptIndex(client, request.scriptLang(), request.id(), request.version(), request.versionType()); listener.onResponse(new GetIndexedScriptResponse(scriptResponse));
listener.onResponse(new GetIndexedScriptResponse(scriptResponse));
} catch(Throwable e){
listener.onFailure(e);
}
} }
} }

View File

@ -20,9 +20,9 @@
package org.elasticsearch.action.indexedscripts.put; package org.elasticsearch.action.indexedscripts.put;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.DelegatingActionListener; import org.elasticsearch.action.support.DelegatingActionListener;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
@ -36,8 +36,8 @@ import org.elasticsearch.transport.TransportService;
*/ */
public class TransportPutIndexedScriptAction extends HandledTransportAction<PutIndexedScriptRequest, PutIndexedScriptResponse> { public class TransportPutIndexedScriptAction extends HandledTransportAction<PutIndexedScriptRequest, PutIndexedScriptResponse> {
private ScriptService scriptService; private final ScriptService scriptService;
private Client client; private final Client client;
@Inject @Inject
public TransportPutIndexedScriptAction(Settings settings, ThreadPool threadPool, 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) { 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) { scriptService.putScriptToIndex(client, request.safeSource(), request.scriptLang(), request.id(), null, request.opType().toString(), request.version(), request.versionType(), new DelegatingActionListener<IndexResponse,PutIndexedScriptResponse>(listener) {
@Override @Override
public PutIndexedScriptResponse getDelegatedFromInstigator(IndexResponse indexResponse){ public PutIndexedScriptResponse getDelegatedFromInstigator(IndexResponse indexResponse){
return new PutIndexedScriptResponse(indexResponse.getType(),indexResponse.getId(),indexResponse.getVersion(),indexResponse.isCreated()); return new PutIndexedScriptResponse(indexResponse.getType(),indexResponse.getId(),indexResponse.getVersion(),indexResponse.isCreated());
} }
}); });