Name the task scheduler bean

This commit is contained in:
jamesagnew 2018-02-04 13:32:34 -05:00
parent 087a130ded
commit 48330a0fa6
2 changed files with 16 additions and 12 deletions

View File

@ -49,6 +49,8 @@ import javax.annotation.Resource;
@EnableJpaRepositories(basePackages = "ca.uhn.fhir.jpa.dao.data")
public class BaseConfig implements SchedulingConfigurer {
public static final String TASK_EXECUTOR_NAME = "hapiJpaTaskExecutor";
@Autowired
protected Environment myEnv;
@Resource
@ -87,18 +89,6 @@ public class BaseConfig implements SchedulingConfigurer {
return new StaleSearchDeletingSvcImpl();
}
@Bean
@Lazy
public SubscriptionRestHookInterceptor subscriptionRestHookInterceptor() {
return new SubscriptionRestHookInterceptor();
}
@Bean
@Lazy
public SubscriptionWebsocketInterceptor subscriptionWebsocketInterceptor() {
return new SubscriptionWebsocketInterceptor();
}
/**
* Note: If you're going to use this, you need to provide a bean
* of type {@link ca.uhn.fhir.jpa.subscription.email.IEmailSender}
@ -111,6 +101,18 @@ public class BaseConfig implements SchedulingConfigurer {
}
@Bean
@Lazy
public SubscriptionRestHookInterceptor subscriptionRestHookInterceptor() {
return new SubscriptionRestHookInterceptor();
}
@Bean
@Lazy
public SubscriptionWebsocketInterceptor subscriptionWebsocketInterceptor() {
return new SubscriptionWebsocketInterceptor();
}
@Bean(name=TASK_EXECUTOR_NAME)
public TaskScheduler taskScheduler() {
ConcurrentTaskScheduler retVal = new ConcurrentTaskScheduler();
retVal.setConcurrentExecutor(scheduledExecutorService().getObject());

View File

@ -23,6 +23,7 @@ package ca.uhn.fhir.jpa.subscription;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.config.BaseConfig;
import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.dao.SearchParameterMap;
import ca.uhn.fhir.jpa.provider.ServletSubRequestDetails;
@ -96,6 +97,7 @@ public abstract class BaseSubscriptionInterceptor<S extends IBaseResource> exten
@Autowired()
private PlatformTransactionManager myTxManager;
@Autowired
@Qualifier(BaseConfig.TASK_EXECUTOR_NAME)
private AsyncTaskExecutor myAsyncTaskExecutor;
/**