From 290a2cb4acbb5f13422550b5fd64c47dfb7a5469 Mon Sep 17 00:00:00 2001 From: dsyer Date: Thu, 4 Jun 2009 16:35:17 +0000 Subject: [PATCH] RESOLVED - issue BATCH-1272: Write skips do not work in a multi-threaded step Problems with test case? --- .../scope/context/StepContextRepeatCallbackTests.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepContextRepeatCallbackTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepContextRepeatCallbackTests.java index eab49c1bb..62abfa53a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepContextRepeatCallbackTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/scope/context/StepContextRepeatCallbackTests.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertTrue; import java.util.concurrent.CountDownLatch; +import org.apache.commons.logging.LogFactory; import org.junit.After; import org.junit.Test; import org.springframework.batch.core.ExitStatus; @@ -88,11 +89,15 @@ public class StepContextRepeatCallbackTests { @Test public void testUnfinishedWork() throws Exception { StepSynchronizationManager.register(stepExecution); - final CountDownLatch latch = new CountDownLatch(2); + final CountDownLatch latch = new CountDownLatch(1); final StepContextRepeatCallback callback = new StepContextRepeatCallback(stepExecution) { @Override public RepeatStatus doInChunkContext(RepeatContext context, ChunkContext chunkContext) throws Exception { - if (context==null) latch.await(); + if (context==null) { + LogFactory.getLog(getClass()).debug("Waiting for latch"); + latch.await(); + LogFactory.getLog(getClass()).debug("Released"); + } return RepeatStatus.FINISHED; } };