in src/main/java/com/amazonaws/services/simpleworkflow/flow/worker/GenericWorker.java [66:102]
public void run() {
try {
while(true) {
log.debug("poll task begin");
if (pollingExecutor.isShutdown() || workerExecutor.isShutdown()) {
return;
}
final int availableWorkers = workerExecutor.getMaximumPoolSize() - workerExecutor.getActiveCount();
if (availableWorkers < 1) {
log.debug("no available workers");
return;
}
pollBackoffThrottler.throttle();
if (pollingExecutor.isShutdown() || workerExecutor.isShutdown()) {
return;
}
if (pollRateThrottler != null) {
pollRateThrottler.throttle();
}
if (pollingExecutor.isShutdown() || workerExecutor.isShutdown()) {
return;
}
T task = poller.poll();
if (task == null) {
log.debug("no work returned");
return;
}
workerExecutor.execute(new ExecuteTask(poller, task));
log.debug("poll task end");
}
} catch (final Throwable e) {
pollBackoffThrottler.failure();
if (!(e.getCause() instanceof InterruptedException)) {
uncaughtExceptionHandler.uncaughtException(Thread.currentThread(), e);
}
}
}