Switched all catch (Exception e) to catch (Throwable e)

This commit is contained in:
Boaz Leskes 2013-08-19 14:01:48 +02:00
parent 097b4078a4
commit b1ac8e9027
1 changed files with 11 additions and 12 deletions

View File

@ -166,7 +166,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
}
ops[requestIndex] = result.op;
}
} catch (Exception e) {
} catch (Throwable e) {
// rethrow the failure if we are going to retry on primary and let parent failure to handle it
if (retryPrimaryException(e)) {
// restore updated versions...
@ -191,7 +191,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
// add the response
DeleteResponse deleteResponse = shardDeleteOperation(deleteRequest, indexShard).response();
responses[requestIndex] = new BulkItemResponse(item.id(), "delete", deleteResponse);
} catch (Exception e) {
} catch (Throwable e) {
// rethrow the failure if we are going to retry on primary and let parent failure to handle it
if (retryPrimaryException(e)) {
// restore updated versions...
@ -275,12 +275,12 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
if (updateAttemptsCount >= updateRequest.retryOnConflict()) {
// we can't try any more
responses[requestIndex] = new BulkItemResponse(item.id(), "update",
new BulkItemResponse.Failure(updateRequest.index(), updateRequest.type(), updateRequest.id(), ExceptionsHelper.detailedMessage(t)));;
new BulkItemResponse.Failure(updateRequest.index(), updateRequest.type(), updateRequest.id(), ExceptionsHelper.detailedMessage(t)));
;
request.items()[requestIndex] = null; // do not send to replicas
}
}
else {
}
} else {
// rethrow the failure if we are going to retry on primary and let parent failure to handle it
if (retryPrimaryException(t)) {
// restore updated versions...
@ -339,7 +339,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
if (request.refresh()) {
try {
indexShard.refresh(new Engine.Refresh(false));
} catch (Exception e) {
} catch (Throwable e) {
// ignore
}
}
@ -516,7 +516,6 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
}
}
@Override
protected void shardOperationOnReplica(ReplicaOperationRequest shardRequest) {
IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.index()).shardSafe(shardRequest.shardId);
final BulkShardRequest request = shardRequest.request;
@ -538,7 +537,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
Engine.Create create = indexShard.prepareCreate(sourceToParse).version(indexRequest.version()).origin(Engine.Operation.Origin.REPLICA);
indexShard.create(create);
}
} catch (Exception e) {
} catch (Throwable e) {
// ignore, we are on backup
}
} else if (item.request() instanceof DeleteRequest) {
@ -546,7 +545,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
try {
Engine.Delete delete = indexShard.prepareDelete(deleteRequest.type(), deleteRequest.id(), deleteRequest.version()).origin(Engine.Operation.Origin.REPLICA);
indexShard.delete(delete);
} catch (Exception e) {
} catch (Throwable e) {
// ignore, we are on backup
}
}
@ -555,7 +554,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
if (request.refresh()) {
try {
indexShard.refresh(new Engine.Refresh(false));
} catch (Exception e) {
} catch (Throwable e) {
// ignore
}
}
@ -585,7 +584,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
}
}
});
} catch (Exception e) {
} catch (Throwable e) {
logger.warn("failed to update master on updated mapping for index [{}], type [{}]", e, index, type);
}
}