Catch Throwable when listener is called rather then Exception to prevent possible hangs if fatal exceptions or errors are thrown

This commit is contained in:
Simon Willnauer 2013-04-04 22:58:20 +02:00
parent a206aa4548
commit f1dd867c4f
77 changed files with 114 additions and 114 deletions

View File

@ -274,7 +274,7 @@ public class TransportBulkAction extends TransportAction<BulkRequest, BulkRespon
public void onResponse(BulkResponse result) { public void onResponse(BulkResponse result) {
try { try {
channel.sendResponse(result); channel.sendResponse(result);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -132,7 +132,7 @@ public class TransportMultiGetAction extends TransportAction<MultiGetRequest, Mu
public void onResponse(MultiGetResponse response) { public void onResponse(MultiGetResponse response) {
try { try {
channel.sendResponse(response); channel.sendResponse(response);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -106,7 +106,7 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi
// we have the index, do it // we have the index, do it
try { try {
innerExecute(request, listener); innerExecute(request, listener);
} catch (Exception e1) { } catch (Throwable e1) {
listener.onFailure(e1); listener.onFailure(e1);
} }
} else { } else {

View File

@ -182,7 +182,7 @@ public class TransportMoreLikeThisAction extends TransportAction<MoreLikeThisReq
// exclude myself // exclude myself
Term uidTerm = docMapper.uidMapper().term(request.type(), request.id()); Term uidTerm = docMapper.uidMapper().term(request.type(), request.id());
boolBuilder.mustNot(termQuery(uidTerm.field(), uidTerm.text())); boolBuilder.mustNot(termQuery(uidTerm.field(), uidTerm.text()));
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
return; return;
} }
@ -336,7 +336,7 @@ public class TransportMoreLikeThisAction extends TransportAction<MoreLikeThisReq
public void onResponse(SearchResponse result) { public void onResponse(SearchResponse result) {
try { try {
channel.sendResponse(result); channel.sendResponse(result);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -104,7 +104,7 @@ public class TransportMultiSearchAction extends TransportAction<MultiSearchReque
public void onResponse(MultiSearchResponse response) { public void onResponse(MultiSearchResponse response) {
try { try {
channel.sendResponse(response); channel.sendResponse(response);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -137,7 +137,7 @@ public class TransportSearchAction extends TransportAction<SearchRequest, Search
public void onResponse(SearchResponse result) { public void onResponse(SearchResponse result) {
try { try {
channel.sendResponse(result); channel.sendResponse(result);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -73,7 +73,7 @@ public class TransportSearchScrollAction extends TransportAction<SearchScrollReq
} else { } else {
throw new ElasticSearchIllegalArgumentException("Scroll id type [" + scrollId.getType() + "] unrecognized"); throw new ElasticSearchIllegalArgumentException("Scroll id type [" + scrollId.getType() + "] unrecognized");
} }
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
} }
} }
@ -94,7 +94,7 @@ public class TransportSearchScrollAction extends TransportAction<SearchScrollReq
public void onResponse(SearchResponse result) { public void onResponse(SearchResponse result) {
try { try {
channel.sendResponse(result); channel.sendResponse(result);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -172,7 +172,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA
void executeFetchPhase() { void executeFetchPhase() {
try { try {
innerExecuteFetchPhase(); innerExecuteFetchPhase();
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(new ReduceSearchPhaseException("query", "", e, buildShardFailures())); listener.onFailure(new ReduceSearchPhaseException("query", "", e, buildShardFailures()));
} }
} }
@ -263,7 +263,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA
void finishHim() { void finishHim() {
try { try {
innerFinishHim(); innerFinishHim();
} catch (Exception e) { } catch (Throwable e) {
ReduceSearchPhaseException failure = new ReduceSearchPhaseException("fetch", "", e, buildShardFailures()); ReduceSearchPhaseException failure = new ReduceSearchPhaseException("fetch", "", e, buildShardFailures());
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("failed to reduce search", failure); logger.debug("failed to reduce search", failure);

View File

@ -222,7 +222,7 @@ public class TransportSearchScrollQueryAndFetchAction extends AbstractComponent
private void finishHim() { private void finishHim() {
try { try {
innerFinishHim(); innerFinishHim();
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(new ReduceSearchPhaseException("fetch", "", e, buildShardFailures())); listener.onFailure(new ReduceSearchPhaseException("fetch", "", e, buildShardFailures()));
} }
} }

View File

@ -253,7 +253,7 @@ public class TransportSearchScrollQueryThenFetchAction extends AbstractComponent
private void finishHim() { private void finishHim() {
try { try {
innerFinishHim(); innerFinishHim();
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(new ReduceSearchPhaseException("fetch", "", e, buildShardFailures())); listener.onFailure(new ReduceSearchPhaseException("fetch", "", e, buildShardFailures()));
} }
} }

View File

@ -227,7 +227,7 @@ public abstract class TransportSearchTypeAction extends TransportAction<SearchRe
if (xTotalOps == expectedTotalOps) { if (xTotalOps == expectedTotalOps) {
try { try {
moveToSecondPhase(); moveToSecondPhase();
} catch (Exception e) { } catch (Throwable e) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug(shardIt.shardId() + ": Failed to execute [" + request + "] while moving to second phase", e); logger.debug(shardIt.shardId() + ": Failed to execute [" + request + "] while moving to second phase", e);
} }
@ -261,7 +261,7 @@ public abstract class TransportSearchTypeAction extends TransportAction<SearchRe
} else { } else {
try { try {
moveToSecondPhase(); moveToSecondPhase();
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(new ReduceSearchPhaseException(firstPhaseName(), "", e, buildShardFailures())); listener.onFailure(new ReduceSearchPhaseException(firstPhaseName(), "", e, buildShardFailures()));
} }
} }

View File

@ -59,7 +59,7 @@ public abstract class TransportAction<Request extends ActionRequest, Response ex
} }
try { try {
doExecute(request, listener); doExecute(request, listener);
} catch (Exception e) { } catch (Throwable e) {
logger.trace("Error during transport action execution.", e); logger.trace("Error during transport action execution.", e);
listener.onFailure(e); listener.onFailure(e);
} }
@ -85,7 +85,7 @@ public abstract class TransportAction<Request extends ActionRequest, Response ex
public void run() { public void run() {
try { try {
listener.onResponse(response); listener.onResponse(response);
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
} }
} }

View File

@ -395,7 +395,7 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
public void onResponse(Response response) { public void onResponse(Response response) {
try { try {
channel.sendResponse(response); channel.sendResponse(response);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -135,7 +135,7 @@ public abstract class TransportMasterNodeOperationAction<Request extends MasterN
try { try {
Response response = masterOperation(request, clusterState); Response response = masterOperation(request, clusterState);
listener.onResponse(response); listener.onResponse(response);
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
} }
} }
@ -261,7 +261,7 @@ public abstract class TransportMasterNodeOperationAction<Request extends MasterN
public void onResponse(Response response) { public void onResponse(Response response) {
try { try {
channel.sendResponse(response); channel.sendResponse(response);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -148,7 +148,7 @@ public abstract class TransportNodesOperationAction<Request extends NodesOperati
public void run() { public void run() {
try { try {
onOperation(nodeOperation(newNodeRequest(clusterState.nodes().localNodeId(), request))); onOperation(nodeOperation(newNodeRequest(clusterState.nodes().localNodeId(), request)));
} catch (Exception e) { } catch (Throwable e) {
onFailure(clusterState.nodes().localNodeId(), e); onFailure(clusterState.nodes().localNodeId(), e);
} }
} }
@ -159,7 +159,7 @@ public abstract class TransportNodesOperationAction<Request extends NodesOperati
public void run() { public void run() {
try { try {
onOperation(nodeOperation(newNodeRequest(clusterState.nodes().masterNodeId(), request))); onOperation(nodeOperation(newNodeRequest(clusterState.nodes().masterNodeId(), request)));
} catch (Exception e) { } catch (Throwable e) {
onFailure(clusterState.nodes().masterNodeId(), e); onFailure(clusterState.nodes().masterNodeId(), e);
} }
} }
@ -237,7 +237,7 @@ public abstract class TransportNodesOperationAction<Request extends NodesOperati
TransportResponseOptions options = TransportResponseOptions.options().withCompress(transportCompress()); TransportResponseOptions options = TransportResponseOptions.options().withCompress(transportCompress());
try { try {
channel.sendResponse(response, options); channel.sendResponse(response, options);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -76,7 +76,7 @@ public abstract class TransportIndexReplicationOperationAction<Request extends I
GroupShardsIterator groups; GroupShardsIterator groups;
try { try {
groups = shards(request); groups = shards(request);
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
return; return;
} }
@ -153,7 +153,7 @@ public abstract class TransportIndexReplicationOperationAction<Request extends I
public void onResponse(Response result) { public void onResponse(Response result) {
try { try {
channel.sendResponse(result); channel.sendResponse(result);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -157,7 +157,7 @@ public abstract class TransportIndicesReplicationOperationAction<Request extends
public void onResponse(Response result) { public void onResponse(Response result) {
try { try {
channel.sendResponse(result); channel.sendResponse(result);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -220,7 +220,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
public void onResponse(Response result) { public void onResponse(Response result) {
try { try {
channel.sendResponse(result); channel.sendResponse(result);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }
@ -372,7 +372,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
} }
} }
shardIt = shards(clusterState, request); shardIt = shards(clusterState, request);
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
return true; return true;
} }

View File

@ -120,7 +120,7 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
performFirst(); performFirst();
} }
private void onFailure(ShardRouting shardRouting, Exception e) { private void onFailure(ShardRouting shardRouting, Throwable e) {
if (logger.isTraceEnabled() && e != null) { if (logger.isTraceEnabled() && e != null) {
logger.trace(shardRouting.shortSummary() + ": Failed to execute [" + request + "]", e); logger.trace(shardRouting.shortSummary() + ": Failed to execute [" + request + "]", e);
} }
@ -141,7 +141,7 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
try { try {
Response response = shardOperation(request, -1); Response response = shardOperation(request, -1);
listener.onResponse(response); listener.onResponse(response);
} catch (Exception e) { } catch (Throwable e) {
onFailure(null, e); onFailure(null, e);
} }
} }
@ -152,7 +152,7 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
final Response response = shardOperation(request, -1); final Response response = shardOperation(request, -1);
listener.onResponse(response); listener.onResponse(response);
return; return;
} catch (Exception e) { } catch (Throwable e) {
onFailure(null, e); onFailure(null, e);
} }
} }
@ -174,7 +174,7 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
try { try {
Response response = shardOperation(request, shard.id()); Response response = shardOperation(request, shard.id());
listener.onResponse(response); listener.onResponse(response);
} catch (Exception e) { } catch (Throwable e) {
shardsIt.reset(); shardsIt.reset();
onFailure(shard, e); onFailure(shard, e);
} }
@ -186,7 +186,7 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
final Response response = shardOperation(request, shard.id()); final Response response = shardOperation(request, shard.id());
listener.onResponse(response); listener.onResponse(response);
return; return;
} catch (Exception e) { } catch (Throwable e) {
shardsIt.reset(); shardsIt.reset();
onFailure(shard, e); onFailure(shard, e);
} }
@ -203,10 +203,10 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
} }
} }
private void perform(final Exception lastException) { private void perform(final Throwable lastException) {
final ShardRouting shard = shardsIt == null ? null : shardsIt.nextOrNull(); final ShardRouting shard = shardsIt == null ? null : shardsIt.nextOrNull();
if (shard == null) { if (shard == null) {
Exception failure = lastException; Throwable failure = lastException;
if (failure == null) { if (failure == null) {
failure = new NoShardAvailableActionException(null, "No shard available for [" + request + "]"); failure = new NoShardAvailableActionException(null, "No shard available for [" + request + "]");
} else { } else {
@ -227,7 +227,7 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
try { try {
Response response = shardOperation(request, shard.id()); Response response = shardOperation(request, shard.id());
listener.onResponse(response); listener.onResponse(response);
} catch (Exception e) { } catch (Throwable e) {
onFailure(shard, e); onFailure(shard, e);
} }
} }
@ -236,7 +236,7 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
try { try {
final Response response = shardOperation(request, shard.id()); final Response response = shardOperation(request, shard.id());
listener.onResponse(response); listener.onResponse(response);
} catch (Exception e) { } catch (Throwable e) {
onFailure(shard, e); onFailure(shard, e);
} }
} }
@ -289,7 +289,7 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
public void onResponse(Response result) { public void onResponse(Response result) {
try { try {
channel.sendResponse(result); channel.sendResponse(result);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -155,7 +155,7 @@ public abstract class TransportInstanceSingleOperationAction<Request extends Ins
} }
} }
shardIt = shards(clusterState, request); shardIt = shards(clusterState, request);
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
return true; return true;
} }
@ -306,7 +306,7 @@ public abstract class TransportInstanceSingleOperationAction<Request extends Ins
public void onResponse(Response result) { public void onResponse(Response result) {
try { try {
channel.sendResponse(result); channel.sendResponse(result);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -124,17 +124,17 @@ public abstract class TransportShardSingleOperationAction<Request extends Single
perform(null); perform(null);
} }
private void onFailure(ShardRouting shardRouting, Exception e) { private void onFailure(ShardRouting shardRouting, Throwable e) {
if (logger.isTraceEnabled() && e != null) { if (logger.isTraceEnabled() && e != null) {
logger.trace("{}: failed to execute [{}]", e, shardRouting, request); logger.trace("{}: failed to execute [{}]", e, shardRouting, request);
} }
perform(e); perform(e);
} }
private void perform(@Nullable final Exception lastException) { private void perform(@Nullable final Throwable lastException) {
final ShardRouting shardRouting = shardIt.nextOrNull(); final ShardRouting shardRouting = shardIt.nextOrNull();
if (shardRouting == null) { if (shardRouting == null) {
Exception failure = lastException; Throwable failure = lastException;
if (failure == null) { if (failure == null) {
failure = new NoShardAvailableActionException(shardIt.shardId(), "No shard available for [" + request + "]"); failure = new NoShardAvailableActionException(shardIt.shardId(), "No shard available for [" + request + "]");
} else { } else {
@ -155,7 +155,7 @@ public abstract class TransportShardSingleOperationAction<Request extends Single
try { try {
Response response = shardOperation(request, shardRouting.id()); Response response = shardOperation(request, shardRouting.id());
listener.onResponse(response); listener.onResponse(response);
} catch (Exception e) { } catch (Throwable e) {
onFailure(shardRouting, e); onFailure(shardRouting, e);
} }
} }
@ -164,7 +164,7 @@ public abstract class TransportShardSingleOperationAction<Request extends Single
try { try {
final Response response = shardOperation(request, shardRouting.id()); final Response response = shardOperation(request, shardRouting.id());
listener.onResponse(response); listener.onResponse(response);
} catch (Exception e) { } catch (Throwable e) {
onFailure(shardRouting, e); onFailure(shardRouting, e);
} }
} }
@ -219,7 +219,7 @@ public abstract class TransportShardSingleOperationAction<Request extends Single
public void onResponse(Response result) { public void onResponse(Response result) {
try { try {
channel.sendResponse(result); channel.sendResponse(result);
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -173,7 +173,7 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
// we have the index, do it // we have the index, do it
try { try {
innerExecute(request, listener); innerExecute(request, listener);
} catch (Exception e1) { } catch (Throwable e1) {
listener.onFailure(e1); listener.onFailure(e1);
} }
} else { } else {

View File

@ -247,7 +247,7 @@ public class TransportClientNodesService extends AbstractComponent {
} else { } else {
try { try {
callback.doWithNode(nodes.get((index + i) % nodes.size()), this); callback.doWithNode(nodes.get((index + i) % nodes.size()), this);
} catch (Exception e1) { } catch (Throwable e1) {
// retry the next one... // retry the next one...
onFailure(e); onFailure(e);
} }

View File

@ -140,7 +140,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
try { try {
try { try {
validate(request, currentState); validate(request, currentState);
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
return currentState; return currentState;
} }

View File

@ -129,7 +129,7 @@ public class MetaDataDeleteIndexService extends AbstractComponent {
}); });
return newClusterStateBuilder().state(currentState).routingResult(routingResult).metaData(newMetaData).blocks(blocks).build(); return newClusterStateBuilder().state(currentState).routingResult(routingResult).metaData(newMetaData).blocks(blocks).build();
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
return currentState; return currentState;
} }

View File

@ -129,7 +129,7 @@ public class MetaDataIndexAliasesService extends AbstractComponent {
} finally { } finally {
parser.close(); parser.close();
} }
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(new ElasticSearchIllegalArgumentException("failed to parse filter for [" + aliasAction.alias() + "]", e)); listener.onFailure(new ElasticSearchIllegalArgumentException("failed to parse filter for [" + aliasAction.alias() + "]", e));
return currentState; return currentState;
} }

View File

@ -93,7 +93,7 @@ public class MetaDataIndexTemplateService extends AbstractComponent {
try { try {
validate(request); validate(request);
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
return; return;
} }
@ -110,7 +110,7 @@ public class MetaDataIndexTemplateService extends AbstractComponent {
for (Map.Entry<String, IndexMetaData.Custom> entry : request.customs.entrySet()) { for (Map.Entry<String, IndexMetaData.Custom> entry : request.customs.entrySet()) {
templateBuilder.putCustom(entry.getKey(), entry.getValue()); templateBuilder.putCustom(entry.getKey(), entry.getValue());
} }
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
return; return;
} }

View File

@ -203,7 +203,7 @@ public class MetaDataMappingService extends AbstractComponent {
MetaData.Builder builder = newMetaDataBuilder().metaData(currentState.metaData()); MetaData.Builder builder = newMetaDataBuilder().metaData(currentState.metaData());
builder.put(newIndexMetaDataBuilder(indexMetaData).putMapping(new MappingMetaData(updatedMapper))); builder.put(newIndexMetaDataBuilder(indexMetaData).putMapping(new MappingMetaData(updatedMapper)));
return newClusterStateBuilder().state(currentState).metaData(builder).build(); return newClusterStateBuilder().state(currentState).metaData(builder).build();
} catch (Exception e) { } catch (Throwable e) {
logger.warn("failed to dynamically update the mapping in cluster_state from shard", e); logger.warn("failed to dynamically update the mapping in cluster_state from shard", e);
listener.onFailure(e); listener.onFailure(e);
return currentState; return currentState;
@ -256,7 +256,7 @@ public class MetaDataMappingService extends AbstractComponent {
notifyOnPostProcess.set(true); notifyOnPostProcess.set(true);
return ClusterState.builder().state(currentState).metaData(builder).build(); return ClusterState.builder().state(currentState).metaData(builder).build();
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
return currentState; return currentState;
} }
@ -404,7 +404,7 @@ public class MetaDataMappingService extends AbstractComponent {
} }
mappingCreatedAction.add(new CountDownListener(counter, listener), request.timeout); mappingCreatedAction.add(new CountDownListener(counter, listener), request.timeout);
return updatedState; return updatedState;
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
return currentState; return currentState;
} finally { } finally {

View File

@ -265,7 +265,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements
updatedState = newClusterStateBuilder().state(updatedState).routingResult(routingResult).build(); updatedState = newClusterStateBuilder().state(updatedState).routingResult(routingResult).build();
return updatedState; return updatedState;
} catch (Exception e) { } catch (Throwable e) {
listener.onFailure(e); listener.onFailure(e);
return currentState; return currentState;
} }

View File

@ -26,7 +26,7 @@ import org.apache.lucene.util.LongsRef;
import com.google.common.primitives.Longs; import com.google.common.primitives.Longs;
public class SlicedLongList extends AbstractList<Long> implements RandomAccess { public final class SlicedLongList extends AbstractList<Long> implements RandomAccess {
public static final SlicedLongList EMPTY = new SlicedLongList(LongsRef.EMPTY_LONGS, 0, 0); public static final SlicedLongList EMPTY = new SlicedLongList(LongsRef.EMPTY_LONGS, 0, 0);

View File

@ -182,7 +182,7 @@ public class RestClusterHealthAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, status, builder)); channel.sendResponse(new XContentRestResponse(request, status, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -70,7 +70,7 @@ public class RestNodesHotThreadsAction extends BaseRestHandler {
sb.append('\n'); sb.append('\n');
} }
channel.sendResponse(new StringRestResponse(RestStatus.OK, sb.toString())); channel.sendResponse(new StringRestResponse(RestStatus.OK, sb.toString()));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -114,7 +114,7 @@ public class RestNodesInfoAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -70,7 +70,7 @@ public class RestNodesRestartAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -73,7 +73,7 @@ public class RestNodesShutdownAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -136,7 +136,7 @@ public class RestNodesStatsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -82,7 +82,7 @@ public class RestClusterRerouteAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -71,7 +71,7 @@ public class RestClusterGetSettingsAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -68,7 +68,7 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler {
public void onResponse(ClusterUpdateSettingsResponse response) { public void onResponse(ClusterUpdateSettingsResponse response) {
try { try {
channel.sendResponse(new StringRestResponse(RestStatus.OK)); channel.sendResponse(new StringRestResponse(RestStatus.OK));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -76,7 +76,7 @@ public class RestClusterSearchShardsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -74,7 +74,7 @@ public class RestClusterStateAction extends BaseRestHandler {
response.getState().settingsFilter(settingsFilter).toXContent(builder, request); response.getState().settingsFilter(settingsFilter).toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -86,7 +86,7 @@ public class RestGetIndicesAliasesAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -162,7 +162,7 @@ public class RestIndicesAliasesAction extends BaseRestHandler {
.field("acknowledged", response.isAcknowledged()) .field("acknowledged", response.isAcknowledged())
.endObject(); .endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -81,7 +81,7 @@ public class RestAnalyzeAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -96,7 +96,7 @@ public class RestClearIndicesCacheAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -76,7 +76,7 @@ public class RestCreateIndexAction extends BaseRestHandler {
.field("acknowledged", response.isAcknowledged()) .field("acknowledged", response.isAcknowledged())
.endObject(); .endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -63,7 +63,7 @@ public class RestIndicesExistsAction extends BaseRestHandler {
} else { } else {
channel.sendResponse(new StringRestResponse(NOT_FOUND)); channel.sendResponse(new StringRestResponse(NOT_FOUND));
} }
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -64,7 +64,7 @@ public class RestTypesExistsAction extends BaseRestHandler {
} else { } else {
channel.sendResponse(new StringRestResponse(NOT_FOUND)); channel.sendResponse(new StringRestResponse(NOT_FOUND));
} }
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -82,7 +82,7 @@ public class RestFlushAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -68,7 +68,7 @@ public class RestGatewaySnapshotAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -129,7 +129,7 @@ public class RestGetMappingAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, foundAny || indices.length == 0 ? OK : NOT_FOUND, builder)); channel.sendResponse(new XContentRestResponse(request, foundAny || indices.length == 0 ? OK : NOT_FOUND, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -96,7 +96,7 @@ public class RestOptimizeAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -79,7 +79,7 @@ public class RestRefreshAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -73,7 +73,7 @@ public class RestIndicesSegmentsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -97,7 +97,7 @@ public class RestGetSettingsAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, foundAny ? OK : NOT_FOUND, builder)); channel.sendResponse(new XContentRestResponse(request, foundAny ? OK : NOT_FOUND, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -97,7 +97,7 @@ public class RestUpdateSettingsAction extends BaseRestHandler {
.field("ok", true) .field("ok", true)
.endObject(); .endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -120,7 +120,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }
@ -157,7 +157,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }
@ -195,7 +195,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }
@ -239,7 +239,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }
@ -283,7 +283,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }
@ -320,7 +320,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }
@ -358,7 +358,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }
@ -396,7 +396,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }
@ -434,7 +434,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }
@ -472,7 +472,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -82,7 +82,7 @@ public class RestIndicesStatusAction extends BaseRestHandler {
response.toXContent(builder, request, settingsFilter); response.toXContent(builder, request, settingsFilter);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -109,7 +109,7 @@ public class RestGetIndexTemplateAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -132,7 +132,7 @@ public class RestValidateQueryAction extends BaseRestHandler {
} }
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -121,7 +121,7 @@ public class RestGetWarmerAction extends BaseRestHandler {
} }
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -133,7 +133,7 @@ public class RestBulkAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -112,7 +112,7 @@ public class RestCountAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -92,7 +92,7 @@ public class RestDeleteAction extends BaseRestHandler {
status = NOT_FOUND; status = NOT_FOUND;
} }
channel.sendResponse(new XContentRestResponse(request, status, builder)); channel.sendResponse(new XContentRestResponse(request, status, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -120,7 +120,7 @@ public class RestDeleteByQueryAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -126,7 +126,7 @@ public class RestExplainAction extends BaseRestHandler {
} }
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, response.isExists() ? OK : NOT_FOUND, builder)); channel.sendResponse(new XContentRestResponse(request, response.isExists() ? OK : NOT_FOUND, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -79,7 +79,7 @@ public class RestGetAction extends BaseRestHandler {
} else { } else {
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} }
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -67,7 +67,7 @@ public class RestHeadAction extends BaseRestHandler {
} else { } else {
channel.sendResponse(new StringRestResponse(OK)); channel.sendResponse(new StringRestResponse(OK));
} }
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -83,7 +83,7 @@ public class RestMultiGetAction extends BaseRestHandler {
XContentBuilder builder = restContentBuilder(request); XContentBuilder builder = restContentBuilder(request);
response.toXContent(builder, request); response.toXContent(builder, request);
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -128,7 +128,7 @@ public class RestIndexAction extends BaseRestHandler {
status = CREATED; status = CREATED;
} }
channel.sendResponse(new XContentRestResponse(request, status, builder)); channel.sendResponse(new XContentRestResponse(request, status, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -79,7 +79,7 @@ public class RestMainAction extends BaseRestHandler {
builder.field("tagline", "You Know, for Search"); builder.field("tagline", "You Know, for Search");
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, status, builder)); channel.sendResponse(new XContentRestResponse(request, status, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -107,7 +107,7 @@ public class RestMoreLikeThisAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -77,7 +77,7 @@ public class RestPercolateAction extends BaseRestHandler {
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -87,7 +87,7 @@ public class RestMultiSearchAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -93,7 +93,7 @@ public class RestSearchScrollAction extends BaseRestHandler {
response.toXContent(builder, request); response.toXContent(builder, request);
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, response.status(), builder)); channel.sendResponse(new XContentRestResponse(request, response.status(), builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -105,7 +105,7 @@ public class RestSuggestAction extends BaseRestHandler {
} }
builder.endObject(); builder.endObject();
channel.sendResponse(new XContentRestResponse(request, OK, builder)); channel.sendResponse(new XContentRestResponse(request, OK, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }

View File

@ -153,7 +153,7 @@ public class RestUpdateAction extends BaseRestHandler {
status = CREATED; status = CREATED;
} }
channel.sendResponse(new XContentRestResponse(request, status, builder)); channel.sendResponse(new XContentRestResponse(request, status, builder));
} catch (Exception e) { } catch (Throwable e) {
onFailure(e); onFailure(e);
} }
} }