/** * Retrieves the next task to be processed. If the next task cannot be retrieved before the specified cut-off time then null is * returned. If the thread is interrupted then it will return null immediately. * * @param cutoffTime the cut-off time, specified in milliseconds since the Unix epoch * @return the next task to be processed, or null if no task could be retrieved before the cut-off time */ private WorkerTask getNextWorkerTask(final long cutoffTime) { final long maxWaitTime = cutoffTime - System.currentTimeMillis(); try { return bulkWorkerRuntime.getNextWorkerTask(maxWaitTime); } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); return null; } }