first pass scheduler working
This commit is contained in:
parent
90040f4bdd
commit
4c7c574eef
|
@ -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.ISubscriptionMatcher;
|
||||||
import ca.uhn.fhir.jpa.subscription.module.matcher.InMemorySubscriptionMatcher;
|
import ca.uhn.fhir.jpa.subscription.module.matcher.InMemorySubscriptionMatcher;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.consent.IConsentContextServices;
|
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 ca.uhn.fhir.rest.server.sched.ISchedulerService;
|
||||||
import org.hibernate.jpa.HibernatePersistenceProvider;
|
import org.hibernate.jpa.HibernatePersistenceProvider;
|
||||||
import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices;
|
import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices;
|
||||||
|
@ -250,7 +251,11 @@ public abstract class BaseConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ISchedulerService schedulerService() {
|
public ISchedulerService schedulerService() {
|
||||||
return new SchedulerServiceImpl(new HapiSchedulerFactory());
|
return new SchedulerServiceImpl(hapiSchedulerFactory());
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public ISchedulerFactory hapiSchedulerFactory() {
|
||||||
|
return new HapiSchedulerFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -56,10 +56,13 @@ public abstract class BaseHapiScheduler implements IHapiScheduler {
|
||||||
myScheduler.standby();
|
myScheduler.standby();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setProperties() {
|
protected void setProperties() {
|
||||||
myProperties.put("org.quartz.threadPool.threadCount", "4");
|
addProperty("org.quartz.threadPool.threadCount", "4");
|
||||||
myProperties.put("org.quartz.threadPool.threadNamePrefix", myThreadNamePrefix + "-" + myProperties.get(PROP_SCHED_INSTANCE_NAME));
|
addProperty("org.quartz.threadPool.threadNamePrefix", myThreadNamePrefix + "-" + myProperties.get(PROP_SCHED_INSTANCE_NAME));
|
||||||
addProperties(myProperties);
|
}
|
||||||
|
|
||||||
|
protected void addProperty(String key, String value) {
|
||||||
|
myProperties.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -155,8 +158,4 @@ public abstract class BaseHapiScheduler implements IHapiScheduler {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract void addProperties(Properties theProperties);
|
|
||||||
// FIXME KHS
|
|
||||||
// quartzPropertiesClustered(clusteredProperties);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,8 @@
|
||||||
package ca.uhn.fhir.jpa.sched;
|
package ca.uhn.fhir.jpa.sched;
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class ClusteredHapiScheduler extends BaseHapiScheduler {
|
public class ClusteredHapiScheduler extends BaseHapiScheduler {
|
||||||
public ClusteredHapiScheduler(String theThreadNamePrefix, AutowiringSpringBeanJobFactory theSpringBeanJobFactory) {
|
public ClusteredHapiScheduler(String theThreadNamePrefix, AutowiringSpringBeanJobFactory theSpringBeanJobFactory) {
|
||||||
super(theThreadNamePrefix, theSpringBeanJobFactory);
|
super(theThreadNamePrefix, theSpringBeanJobFactory);
|
||||||
setInstanceName("clustered");
|
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_");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,8 @@
|
||||||
package ca.uhn.fhir.jpa.sched;
|
package ca.uhn.fhir.jpa.sched;
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class LocalHapiScheduler extends BaseHapiScheduler {
|
public class LocalHapiScheduler extends BaseHapiScheduler {
|
||||||
public LocalHapiScheduler(String theThreadNamePrefix, AutowiringSpringBeanJobFactory theSpringBeanJobFactory) {
|
public LocalHapiScheduler(String theThreadNamePrefix, AutowiringSpringBeanJobFactory theSpringBeanJobFactory) {
|
||||||
super(theThreadNamePrefix, theSpringBeanJobFactory);
|
super(theThreadNamePrefix, theSpringBeanJobFactory);
|
||||||
setInstanceName("local");
|
setInstanceName("local");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Properties for the local scheduler (see the class docs to learn what this means)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
void addProperties(Properties theProperties) {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
package ca.uhn.fhir.jpa.sched;
|
package ca.uhn.fhir.jpa.sched;
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
class NullScheduler extends BaseHapiScheduler {
|
class NullScheduler extends BaseHapiScheduler {
|
||||||
|
|
||||||
public NullScheduler(String theThreadNamePrefix, AutowiringSpringBeanJobFactory theSpringBeanJobFactory) {
|
public NullScheduler(String theThreadNamePrefix, AutowiringSpringBeanJobFactory theSpringBeanJobFactory) {
|
||||||
super(theThreadNamePrefix, theSpringBeanJobFactory);
|
super(theThreadNamePrefix, theSpringBeanJobFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
void addProperties(Properties theProperties) {
|
|
||||||
//nothing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class QuartzTableSeeder {
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void start() {
|
public void start() {
|
||||||
|
// FIXME KHS what is this?
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,8 +115,10 @@ public class SchedulerServiceImpl implements ISchedulerService, SmartLifecycle {
|
||||||
}
|
}
|
||||||
IHapiScheduler retval;
|
IHapiScheduler retval;
|
||||||
if (theClustered) {
|
if (theClustered) {
|
||||||
|
ourLog.info("Creating Clustered Scheduler");
|
||||||
retval = mySchedulerFactory.newClusteredHapiScheduler();
|
retval = mySchedulerFactory.newClusteredHapiScheduler();
|
||||||
} else {
|
} else {
|
||||||
|
ourLog.info("Creating Local Scheduler");
|
||||||
retval = mySchedulerFactory.newLocalHapiScheduler();
|
retval = mySchedulerFactory.newLocalHapiScheduler();
|
||||||
}
|
}
|
||||||
retval.init();
|
retval.init();
|
||||||
|
|
Loading…
Reference in New Issue