Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Internal: fix members visibility, remove unused constant and needless…
… try catch in indexed scripts transport actions
  • Loading branch information
javanna committed Sep 3, 2014
1 parent 2f42287 commit 4af86b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
Expand Up @@ -36,8 +36,8 @@
*/
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,
Expand Down
Expand Up @@ -35,9 +35,8 @@
*/
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,
Expand All @@ -54,11 +53,7 @@ public GetIndexedScriptRequest newRequestInstance(){

@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));
}
}
Expand Up @@ -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;
Expand All @@ -36,8 +36,8 @@
*/
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,
Expand All @@ -57,7 +57,7 @@ public PutIndexedScriptRequest newRequestInstance(){
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());
}
});
Expand Down

0 comments on commit 4af86b2

Please sign in to comment.