@Override protected void setUp() throws Exception { RepeatSynchronizationManager.clear(); }
@Override protected void tearDown() throws Exception { RepeatSynchronizationManager.clear(); }
@Override protected void tearDown() throws Exception { RepeatSynchronizationManager.clear(); }
@After public void tearDown() throws Exception { RepeatSynchronizationManager.clear(); }
/** * Execute the batch callback until the completion policy decides that we * are finished. Wait for the whole batch to finish before returning even if * the task executor is asynchronous. * * @see org.springframework.batch.repeat.RepeatOperations#iterate(org.springframework.batch.repeat.RepeatCallback) */ @Override public RepeatStatus iterate(RepeatCallback callback) { RepeatContext outer = RepeatSynchronizationManager.getContext(); RepeatStatus result = RepeatStatus.CONTINUABLE; try { // This works with an asynchronous TaskExecutor: the // interceptors have to wait for the child processes. result = executeInternal(callback); } finally { RepeatSynchronizationManager.clear(); if (outer != null) { RepeatSynchronizationManager.register(outer); } } return result; }
/** * 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); } }
public void testClear() { RepeatSynchronizationManager.register(context); assertEquals(context, RepeatSynchronizationManager.getContext()); RepeatSynchronizationManager.clear(); assertEquals(null, RepeatSynchronizationManager.getContext()); }
/** * Execute the batch callback until the completion policy decides that we * are finished. Wait for the whole batch to finish before returning even if * the task executor is asynchronous. * * @see org.springframework.batch.repeat.RepeatOperations#iterate(org.springframework.batch.repeat.RepeatCallback) */ @Override public RepeatStatus iterate(RepeatCallback callback) { RepeatContext outer = RepeatSynchronizationManager.getContext(); RepeatStatus result = RepeatStatus.CONTINUABLE; try { // This works with an asynchronous TaskExecutor: the // interceptors have to wait for the child processes. result = executeInternal(callback); } finally { RepeatSynchronizationManager.clear(); if (outer != null) { RepeatSynchronizationManager.register(outer); } } return result; }
/** * 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); } }