private void execute() throws InterruptedException { final WorkerTaskImpl task = workQueue.take(); final BulkWorkerTaskProvider taskProvider = new BulkWorkerTaskProvider(task, workQueue); try { bulkWorker.processTasks(taskProvider); } catch (final RuntimeException ex) { LOG.warn("Bulk Worker threw unhandled exception", ex); } finally { // Re-submit the first task if it has not been consumed // NB: It's really faulty Worker logic to not consume at least // the one task. if (!taskProvider.isFirstTaskConsumed()) { LOG.warn("Bulk Worker did not consume even the first task; " + "re-submitting it..."); resubmitWorkerTask(task); } // Re-submit any consumed tasks that have not been responded to resubmitIgnoredWorkerTasks(taskProvider); } } }