first pass scheduler working

This commit is contained in:
Ken Stevens 2019-11-25 20:12:45 -05:00
parent 90040f4bdd
commit 4c7c574eef
7 changed files with 16 additions and 38 deletions

View File

@ -36,6 +36,7 @@ import ca.uhn.fhir.jpa.subscription.module.channel.ISubscribableChannelFactory;
import ca.uhn.fhir.jpa.subscription.module.matcher.ISubscriptionMatcher;
import ca.uhn.fhir.jpa.subscription.module.matcher.InMemorySubscriptionMatcher;
import ca.uhn.fhir.rest.server.interceptor.consent.IConsentContextServices;
import ca.uhn.fhir.rest.server.sched.ISchedulerFactory;
import ca.uhn.fhir.rest.server.sched.ISchedulerService;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices;
@ -250,7 +251,11 @@ public abstract class BaseConfig {
@Bean
public ISchedulerService schedulerService() {
return new SchedulerServiceImpl(new HapiSchedulerFactory());
return new SchedulerServiceImpl(hapiSchedulerFactory());
}
@Bean
public ISchedulerFactory hapiSchedulerFactory() {
return new HapiSchedulerFactory();
}
@Bean

View File

@ -56,10 +56,13 @@ public abstract class BaseHapiScheduler implements IHapiScheduler {
myScheduler.standby();
}
private void setProperties() {
myProperties.put("org.quartz.threadPool.threadCount", "4");
myProperties.put("org.quartz.threadPool.threadNamePrefix", myThreadNamePrefix + "-" + myProperties.get(PROP_SCHED_INSTANCE_NAME));
addProperties(myProperties);
protected void setProperties() {
addProperty("org.quartz.threadPool.threadCount", "4");
addProperty("org.quartz.threadPool.threadNamePrefix", myThreadNamePrefix + "-" + myProperties.get(PROP_SCHED_INSTANCE_NAME));
}
protected void addProperty(String key, String value) {
myProperties.put(key, value);
}
@Override
@ -155,8 +158,4 @@ public abstract class BaseHapiScheduler implements IHapiScheduler {
return true;
}
}
abstract void addProperties(Properties theProperties);
// FIXME KHS
// quartzPropertiesClustered(clusteredProperties);
}

View File

@ -1,18 +1,8 @@
package ca.uhn.fhir.jpa.sched;
import java.util.Properties;
public class ClusteredHapiScheduler extends BaseHapiScheduler {
public ClusteredHapiScheduler(String theThreadNamePrefix, AutowiringSpringBeanJobFactory theSpringBeanJobFactory) {
super(theThreadNamePrefix, theSpringBeanJobFactory);
setInstanceName("clustered");
}
/**
* Properties for the cluster scheduler (see the class docs to learn what this means)
*/
@Override
void addProperties(Properties theProperties) {
// theProperties.put("org.quartz.jobStore.tablePrefix", "QRTZHFJC_");
}
}

View File

@ -1,18 +1,8 @@
package ca.uhn.fhir.jpa.sched;
import java.util.Properties;
public class LocalHapiScheduler extends BaseHapiScheduler {
public LocalHapiScheduler(String theThreadNamePrefix, AutowiringSpringBeanJobFactory theSpringBeanJobFactory) {
super(theThreadNamePrefix, theSpringBeanJobFactory);
setInstanceName("local");
}
/**
* Properties for the local scheduler (see the class docs to learn what this means)
*/
@Override
void addProperties(Properties theProperties) {
// nothing
}
}

View File

@ -1,15 +1,7 @@
package ca.uhn.fhir.jpa.sched;
import java.util.Properties;
class NullScheduler extends BaseHapiScheduler {
public NullScheduler(String theThreadNamePrefix, AutowiringSpringBeanJobFactory theSpringBeanJobFactory) {
super(theThreadNamePrefix, theSpringBeanJobFactory);
}
@Override
void addProperties(Properties theProperties) {
//nothing
}
}

View File

@ -32,7 +32,7 @@ public class QuartzTableSeeder {
@PostConstruct
public void start() {
// FIXME KHS what is this?
}
}

View File

@ -115,8 +115,10 @@ public class SchedulerServiceImpl implements ISchedulerService, SmartLifecycle {
}
IHapiScheduler retval;
if (theClustered) {
ourLog.info("Creating Clustered Scheduler");
retval = mySchedulerFactory.newClusteredHapiScheduler();
} else {
ourLog.info("Creating Local Scheduler");
retval = mySchedulerFactory.newLocalHapiScheduler();
}
retval.init();