Refactored TaskScheduler to use the new Trigger interface. Also added the SimpleTaskScheduler implementation.

This commit is contained in:
Mark Fisher
2008-09-24 16:29:14 +00:00
parent 98b32a9516
commit 9e1e1199ee
13 changed files with 298 additions and 436 deletions

View File

@@ -37,8 +37,8 @@ import org.springframework.integration.bus.MessageBusInterceptorTests;
import org.springframework.integration.bus.TestMessageBusAwareImpl;
import org.springframework.integration.bus.TestMessageBusStartInterceptor;
import org.springframework.integration.bus.TestMessageBusStopInterceptor;
import org.springframework.integration.scheduling.SimpleTaskScheduler;
import org.springframework.integration.scheduling.TaskScheduler;
import org.springframework.integration.scheduling.spi.ProviderTaskScheduler;
/**
* @author Mark Fisher
@@ -144,7 +144,7 @@ public class MessageBusParserTests {
context.getBean(AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME);
DirectFieldAccessor accessor = new DirectFieldAccessor(multicaster);
Object taskExecutor = accessor.getPropertyValue("taskExecutor");
assertEquals(ProviderTaskScheduler.class, taskExecutor.getClass());
assertEquals(SimpleTaskScheduler.class, taskExecutor.getClass());
}
@Test

View File

@@ -18,31 +18,23 @@ package org.springframework.integration.config;
import java.util.concurrent.ScheduledFuture;
import org.springframework.integration.scheduling.SchedulableTask;
import org.springframework.integration.scheduling.TaskScheduler;
import org.springframework.integration.util.ErrorHandler;
import org.springframework.integration.scheduling.Trigger;
/**
* @author Mark Fisher
*/
public class StubTaskScheduler implements TaskScheduler {
public boolean cancel(Runnable task, boolean mayInterruptIfRunning) {
return false;
}
public ScheduledFuture<?> schedule(SchedulableTask task) {
public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
return null;
}
public void setErrorHandler(ErrorHandler errorHandler) {
public void execute(Runnable task) {
}
public boolean prefersShortLivedTasks() {
return false;
}
public void execute(Runnable task) {
return true;
}
public boolean isRunning() {