/** * Tell the queue to expect a result. */ public void expect() { try { queue.expect(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RepeatException("InterruptedException waiting for to acquire lock on input."); } }
while (queue.isExpecting()) { future = queue.take(); Assert.state(queue.isEmpty(), "Future results queue should be empty at end of batch.");
/** * Execute the batch callback, and store the result, or any exception * that is thrown for retrieval later by caller. * * @see java.lang.Runnable#run() */ @Override public void run() { boolean clearContext = false; try { if (RepeatSynchronizationManager.getContext() == null) { clearContext = true; RepeatSynchronizationManager.register(context); } if (logger.isDebugEnabled()) { logger.debug("Repeat operation about to start at count=" + context.getStartedCount()); } result = callback.doInIteration(context); } catch (Throwable e) { error = e; } finally { if (clearContext) { RepeatSynchronizationManager.clear(); } queue.put(this); } }
while (queue.isExpecting()) { future = queue.take(); Assert.state(queue.isEmpty(), "Future results queue should be empty at end of batch.");
/** * Tell the queue to expect a result. */ public void expect() { try { queue.expect(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RepeatException("InterruptedException waiting for to acquire lock on input."); } }
/** * Execute the batch callback, and store the result, or any exception * that is thrown for retrieval later by caller. * * @see java.lang.Runnable#run() */ @Override public void run() { boolean clearContext = false; try { if (RepeatSynchronizationManager.getContext() == null) { clearContext = true; RepeatSynchronizationManager.register(context); } if (logger.isDebugEnabled()) { logger.debug("Repeat operation about to start at count=" + context.getStartedCount()); } result = callback.doInIteration(context); } catch (Throwable e) { error = e; } finally { if (clearContext) { RepeatSynchronizationManager.clear(); } queue.put(this); } }