@Override public TaskResult call() { try { if (recordProcessor instanceof IShutdownNotificationAware) { IShutdownNotificationAware shutdownNotificationAware = (IShutdownNotificationAware) recordProcessor; try { shutdownNotificationAware.shutdownRequested(recordProcessorCheckpointer); } catch (Exception ex) { return new TaskResult(ex); } } return new TaskResult(null); } finally { shutdownNotification.shutdownNotificationComplete(); } }
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; }
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()); } } }
/** * {@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; }
@Override public TaskResult call() { Exception exception = null; try { ShardSyncer.checkAndCreateLeasesForNewShards(kinesisProxy, leaseManager, initialPosition, cleanupLeasesUponShardCompletion, ignoreUnexpectedChildShards); if (shardSyncTaskIdleTimeMillis > 0) { Thread.sleep(shardSyncTaskIdleTimeMillis); } } catch (Exception e) { LOG.error("Caught exception while sync'ing Kinesis shards and leases", e); exception = e; } return new TaskResult(exception); }
try { TaskResult result = future.get(); if (result.getException() != null) { LOG.error("Caught exception running " + currentTask.getTaskType() + " task: ", result.getException());
LOG.info("No need to block on parents " + shardInfo.getParentShardIds() + " of shard " + shardInfo.getShardId()); return new TaskResult(null); return new TaskResult(exception);
if (result == null || result.getException() == null) { if (!leaseCoordinator.isRunning()) { LOG.info("Starting LeaseCoordinator"); lastException = result.getException();
return new TaskResult(null); } catch (Exception e) { if (applicationException) { return new TaskResult(exception);
return new TaskResult(null); } catch (Exception e) { if (applicationException) { return new TaskResult(exception);
if (dataFetcher.isShardEndReached()) { LOG.info("Reached end of shard " + shardInfo.getShardId()); return new TaskResult(null, true); return new TaskResult(exception);