private void logTaskException(TaskResult taskResult) { if (LOG.isDebugEnabled()) { Exception taskException = taskResult.getException(); if (taskException instanceof BlockedOnParentShardException) { // No need to log the stack trace for this exception (it is very specific). LOG.debug("Shard " + shardInfo.getShardId() + " is blocked on completion of parent shard."); } else { LOG.debug("Caught exception running " + currentTask.getTaskType() + " task: ", taskResult.getException()); } } }
private TaskOutcome determineTaskOutcome() { try { TaskResult result = future.get(); if (result.getException() == null) { if (result.isShardEndReached()) { return TaskOutcome.END_OF_SHARD; } return TaskOutcome.SUCCESSFUL; } logTaskException(result); } catch (Exception e) { throw new RuntimeException(e); } finally { // Setting future to null so we don't misinterpret task completion status in case of exceptions future = null; } return TaskOutcome.FAILURE; }
/** * {@inheritDoc} */ @Override public TaskResult call() { MetricsHelper.startScope(factory, other.getClass().getSimpleName()); TaskResult result = null; final long startTimeMillis = System.currentTimeMillis(); try { result = other.call(); } finally { MetricsHelper.addSuccessAndLatency(startTimeMillis, result != null && result.getException() == null, MetricsLevel.SUMMARY); MetricsHelper.endScope(); } return result; }
try { TaskResult result = future.get(); if (result.getException() != null) { LOG.error("Caught exception running " + currentTask.getTaskType() + " task: ", result.getException());
if (result == null || result.getException() == null) { if (!leaseCoordinator.isRunning()) { LOG.info("Starting LeaseCoordinator"); lastException = result.getException();