diff --git a/org.springframework.integration.quartz/src/main/java/org/springframework/integration/quartz/QuartzScheduleServiceProvider.java b/org.springframework.integration.quartz/src/main/java/org/springframework/integration/quartz/QuartzScheduleServiceProvider.java index 2b56f3679e..d0edec7d1b 100644 --- a/org.springframework.integration.quartz/src/main/java/org/springframework/integration/quartz/QuartzScheduleServiceProvider.java +++ b/org.springframework.integration.quartz/src/main/java/org/springframework/integration/quartz/QuartzScheduleServiceProvider.java @@ -173,7 +173,7 @@ public class QuartzScheduleServiceProvider implements ScheduleServiceProvider { * It is designed to be used for periodic tasks, therefore get() either block or throw * {@link java.util.concurrent.CancellationException}. */ - private class ScheduledFutureJobWrapper implements ScheduledFuture { + public class ScheduledFutureJobWrapper implements ScheduledFuture { private final Scheduler scheduler; @@ -249,7 +249,7 @@ public class QuartzScheduleServiceProvider implements ScheduleServiceProvider { /** * Wrapper class allowing for Quartz jobs to be interrupted. */ - private static class InterruptableMethodInvokingJob extends MethodInvokingJobDetailFactoryBean.MethodInvokingJob + public static class InterruptableMethodInvokingJob extends MethodInvokingJobDetailFactoryBean.MethodInvokingJob implements InterruptableJob { private Thread executionThread; @@ -275,7 +275,7 @@ public class QuartzScheduleServiceProvider implements ScheduleServiceProvider { private final String name; - public FixedDelayJobListener() { + private FixedDelayJobListener() { this.name = generateNameForInstance(this); } diff --git a/org.springframework.integration.quartz/src/test/java/org/springframework/integration/quartz/TestQuartzScheduleServiceProvider.java b/org.springframework.integration.quartz/src/test/java/org/springframework/integration/quartz/TestQuartzScheduleServiceProvider.java index 1926adf1eb..e2675c8aa9 100644 --- a/org.springframework.integration.quartz/src/test/java/org/springframework/integration/quartz/TestQuartzScheduleServiceProvider.java +++ b/org.springframework.integration.quartz/src/test/java/org/springframework/integration/quartz/TestQuartzScheduleServiceProvider.java @@ -55,7 +55,7 @@ public class TestQuartzScheduleServiceProvider extends AbstractJUnit4SpringConte CountDownLatch latch = new CountDownLatch(1); AtomicBoolean hasRun = new AtomicBoolean(false); scheduleServiceProvider.execute(new SimpleRunnable(latch, hasRun)); - latch.await(500, TimeUnit.MILLISECONDS); + latch.await(1000, TimeUnit.MILLISECONDS); assertTrue(hasRun.get()); } @@ -121,7 +121,7 @@ public class TestQuartzScheduleServiceProvider extends AbstractJUnit4SpringConte AtomicBoolean hasRun = new AtomicBoolean(false); SimpleRunnable runnable = new SimpleRunnable(latch, hasRun); scheduleServiceProvider.scheduleWithFixedDelay(runnable, 500, 500, TimeUnit.MILLISECONDS); - latch.await(2000, TimeUnit.MILLISECONDS); + latch.await(3000, TimeUnit.MILLISECONDS); assertTrue(hasRun.get()); } @@ -153,7 +153,6 @@ public class TestQuartzScheduleServiceProvider extends AbstractJUnit4SpringConte } public void run() { - hasRun.set(latch.getCount() == 1); this.executionTimes.add(new Date().getTime()); try { Thread.sleep(500); @@ -162,6 +161,9 @@ public class TestQuartzScheduleServiceProvider extends AbstractJUnit4SpringConte Thread.currentThread().interrupt(); } latch.countDown(); + if (latch.getCount() == 0) { + hasRun.set(true); + } } }