From 45a5db6fd8314974d58db5f8eafa3c14873ef1f8 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Mon, 19 Nov 2018 13:31:01 -0500 Subject: [PATCH] One more fix --- .../java/ca/uhn/fhir/jpa/config/BaseConfig.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java index 235eeca6adf..74e51f44892 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java @@ -55,7 +55,6 @@ import org.springframework.scheduling.concurrent.ScheduledExecutorFactoryBean; import org.springframework.scheduling.config.ScheduledTaskRegistrar; import javax.annotation.Nonnull; -import java.util.concurrent.ScheduledExecutorService; @Configuration @@ -112,11 +111,11 @@ public abstract class BaseConfig implements SchedulingConfigurer { } @Bean() - public ScheduledExecutorService scheduledExecutorService() { + public ScheduledExecutorFactoryBean scheduledExecutorService() { ScheduledExecutorFactoryBean b = new ScheduledExecutorFactoryBean(); b.setPoolSize(5); b.afterPropertiesSet(); - return b.getObject(); + return b; } @Bean(name = "mySubscriptionTriggeringProvider") @@ -166,16 +165,16 @@ public abstract class BaseConfig implements SchedulingConfigurer { @Bean() public TaskScheduler taskScheduler() { ConcurrentTaskScheduler retVal = new ConcurrentTaskScheduler(); - retVal.setConcurrentExecutor(scheduledExecutorService()); - retVal.setScheduledExecutor(scheduledExecutorService()); + retVal.setConcurrentExecutor(scheduledExecutorService().getObject()); + retVal.setScheduledExecutor(scheduledExecutorService().getObject()); return retVal; } @Bean(name = TASK_EXECUTOR_NAME) public AsyncTaskExecutor taskExecutor() { ConcurrentTaskScheduler retVal = new ConcurrentTaskScheduler(); - retVal.setConcurrentExecutor(scheduledExecutorService()); - retVal.setScheduledExecutor(scheduledExecutorService()); + retVal.setConcurrentExecutor(scheduledExecutorService().getObject()); + retVal.setScheduledExecutor(scheduledExecutorService().getObject()); return retVal; }