Schedule jobs via IJobScheduler instead of in @PostConstruct (#4415)
* parameterizing BinaryStorageInterceptor * parameterizing BinaryStorageInterceptor * changed jobs scheduling from @PostConstruct to coordinated by HapiLifecycleService events * fix test * remove events for now * fix test * simplify design * FIXME * changelog * fix compile issue * review feedback. partially implemented * review feedback * review feedback * bump hapi version to 6.3.8-SNAPSHOT * fix test * mirror contextclosedevent handlers with contextrefreshedevent * version bump * licenses Co-authored-by: Ken Stevens <ken@smilecdr.com>
This commit is contained in:
parent
0d79d2026e
commit
04c28b6c08
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-bom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>HAPI FHIR BOM</name>
|
||||
|
||||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-cli</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../../hapi-deployable-pom</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
type: change
|
||||
issue: 3439
|
||||
title: 'Previously, jobs were scheduled via a @PostConstruct annotated method. This has been changed to an implementation
|
||||
of IJobScheduler interface so the job scheduler can schedule all the jobs after it has been started.'
|
|
@ -11,7 +11,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -20,22 +20,11 @@ package ca.uhn.fhir.jaxrs.server;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.jaxrs.server.util.JaxRsRequest;
|
||||
import ca.uhn.fhir.jaxrs.server.util.JaxRsRequest.Builder;
|
||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||
|
@ -58,15 +47,24 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
|
|||
import org.hl7.fhir.r4.model.CapabilityStatement;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.OPTIONS;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* This is the conformance provider for the jax rs servers. It requires all providers to be registered during startup because the conformance profile is generated during the postconstruct phase.
|
||||
|
@ -91,7 +89,7 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
|
|||
/**
|
||||
* the server configuration
|
||||
*/
|
||||
private RestfulServerConfiguration serverConfiguration = new RestfulServerConfiguration();
|
||||
private RestfulServerConfiguration myServerConfiguration = new RestfulServerConfiguration();
|
||||
|
||||
/**
|
||||
* the conformance. It is created once during startup
|
||||
|
@ -111,10 +109,10 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
|
|||
* @param serverVersion the server version. If null, "" is used
|
||||
*/
|
||||
protected AbstractJaxRsConformanceProvider(String implementationDescription, String serverName, String serverVersion) {
|
||||
serverConfiguration.setFhirContext(getFhirContext());
|
||||
serverConfiguration.setImplementationDescription(StringUtils.defaultIfEmpty(implementationDescription, ""));
|
||||
serverConfiguration.setServerName(StringUtils.defaultIfEmpty(serverName, ""));
|
||||
serverConfiguration.setServerVersion(StringUtils.defaultIfEmpty(serverVersion, ""));
|
||||
myServerConfiguration.setFhirContext(getFhirContext());
|
||||
myServerConfiguration.setImplementationDescription(StringUtils.defaultIfEmpty(implementationDescription, ""));
|
||||
myServerConfiguration.setServerName(StringUtils.defaultIfEmpty(serverName, ""));
|
||||
myServerConfiguration.setServerVersion(StringUtils.defaultIfEmpty(serverVersion, ""));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,10 +125,10 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
|
|||
*/
|
||||
protected AbstractJaxRsConformanceProvider(FhirContext ctx, String implementationDescription, String serverName, String serverVersion) {
|
||||
super(ctx);
|
||||
serverConfiguration.setFhirContext(ctx);
|
||||
serverConfiguration.setImplementationDescription(StringUtils.defaultIfEmpty(implementationDescription, ""));
|
||||
serverConfiguration.setServerName(StringUtils.defaultIfEmpty(serverName, ""));
|
||||
serverConfiguration.setServerVersion(StringUtils.defaultIfEmpty(serverVersion, ""));
|
||||
myServerConfiguration.setFhirContext(ctx);
|
||||
myServerConfiguration.setImplementationDescription(StringUtils.defaultIfEmpty(implementationDescription, ""));
|
||||
myServerConfiguration.setServerName(StringUtils.defaultIfEmpty(serverName, ""));
|
||||
myServerConfiguration.setServerVersion(StringUtils.defaultIfEmpty(serverVersion, ""));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,32 +149,32 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
|
|||
for (ResourceBinding baseMethodBinding : myResourceNameToBinding.values()) {
|
||||
serverBindings.addAll(baseMethodBinding.getMethodBindings());
|
||||
}
|
||||
serverConfiguration.setServerBindings(serverBindings);
|
||||
serverConfiguration.setResourceBindings(new LinkedList<ResourceBinding>(myResourceNameToBinding.values()));
|
||||
serverConfiguration.computeSharedSupertypeForResourcePerName(providers.values());
|
||||
myServerConfiguration.setServerBindings(serverBindings);
|
||||
myServerConfiguration.setResourceBindings(new LinkedList<ResourceBinding>(myResourceNameToBinding.values()));
|
||||
myServerConfiguration.computeSharedSupertypeForResourcePerName(providers.values());
|
||||
HardcodedServerAddressStrategy hardcodedServerAddressStrategy = new HardcodedServerAddressStrategy();
|
||||
hardcodedServerAddressStrategy.setValue(getBaseForServer());
|
||||
serverConfiguration.setServerAddressStrategy(hardcodedServerAddressStrategy);
|
||||
myServerConfiguration.setServerAddressStrategy(hardcodedServerAddressStrategy);
|
||||
FhirVersionEnum fhirContextVersion = super.getFhirContext().getVersion().getVersion();
|
||||
switch (fhirContextVersion) {
|
||||
case R4:
|
||||
ServerCapabilityStatementProvider r4ServerCapabilityStatementProvider = new ServerCapabilityStatementProvider(getFhirContext(), serverConfiguration);
|
||||
ServerCapabilityStatementProvider r4ServerCapabilityStatementProvider = new ServerCapabilityStatementProvider(getFhirContext(), myServerConfiguration);
|
||||
myR4CapabilityStatement = (CapabilityStatement) r4ServerCapabilityStatementProvider.getServerConformance(null, null);
|
||||
break;
|
||||
case DSTU3:
|
||||
org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider dstu3ServerCapabilityStatementProvider = new org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider(serverConfiguration);
|
||||
org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider dstu3ServerCapabilityStatementProvider = new org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider(myServerConfiguration);
|
||||
myDstu3CapabilityStatement = dstu3ServerCapabilityStatementProvider.getServerConformance(null, null);
|
||||
break;
|
||||
case DSTU2_1:
|
||||
org.hl7.fhir.dstu2016may.hapi.rest.server.ServerConformanceProvider dstu2_1ServerConformanceProvider = new org.hl7.fhir.dstu2016may.hapi.rest.server.ServerConformanceProvider(serverConfiguration);
|
||||
org.hl7.fhir.dstu2016may.hapi.rest.server.ServerConformanceProvider dstu2_1ServerConformanceProvider = new org.hl7.fhir.dstu2016may.hapi.rest.server.ServerConformanceProvider(myServerConfiguration);
|
||||
myDstu2_1Conformance = dstu2_1ServerConformanceProvider.getServerConformance(null, null);
|
||||
break;
|
||||
case DSTU2_HL7ORG:
|
||||
ServerConformanceProvider dstu2Hl7OrgServerConformanceProvider = new ServerConformanceProvider(serverConfiguration);
|
||||
ServerConformanceProvider dstu2Hl7OrgServerConformanceProvider = new ServerConformanceProvider(myServerConfiguration);
|
||||
myDstu2Hl7OrgConformance = dstu2Hl7OrgServerConformanceProvider.getServerConformance(null, null);
|
||||
break;
|
||||
case DSTU2:
|
||||
ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider dstu2ServerConformanceProvider = new ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider(serverConfiguration);
|
||||
ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider dstu2ServerConformanceProvider = new ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider(myServerConfiguration);
|
||||
myDstu2Conformance = dstu2ServerConformanceProvider.getServerConformance(null, null);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
@ -20,11 +20,9 @@ package ca.uhn.fhir.jpa.model.sched;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
public interface ISmartLifecyclePhase {
|
||||
// POST_CONSTRUCT is here as a marker for where post-construct fits into the smart lifecycle. Beans with negative phases
|
||||
// will be started before @PostConstruct are called
|
||||
int POST_CONSTRUCT = 0;
|
||||
|
||||
// We want to start scheduled tasks fairly late in the startup process
|
||||
int SCHEDULER_1000 = 1000;
|
||||
/**
|
||||
* This interface is implemented by classes that have scheduled jobs
|
||||
*/
|
||||
public interface IHasScheduledJobs {
|
||||
void scheduleJobs(ISchedulerService theSchedulerService);
|
||||
}
|
|
@ -23,8 +23,8 @@ package ca.uhn.fhir.jpa.sched;
|
|||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHapiScheduler;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISmartLifecyclePhase;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.util.StopWatch;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
@ -34,10 +34,13 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
|
@ -58,7 +61,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
* </li>
|
||||
* </ul>
|
||||
*/
|
||||
public abstract class BaseSchedulerServiceImpl implements ISchedulerService, SmartLifecycle {
|
||||
public abstract class BaseSchedulerServiceImpl implements ISchedulerService {
|
||||
public static final String SCHEDULING_DISABLED = "scheduling_disabled";
|
||||
public static final String SCHEDULING_DISABLED_EQUALS_TRUE = SCHEDULING_DISABLED + "=true";
|
||||
|
||||
|
@ -140,18 +143,10 @@ public abstract class BaseSchedulerServiceImpl implements ISchedulerService, Sma
|
|||
|
||||
protected abstract IHapiScheduler getClusteredScheduler();
|
||||
|
||||
/**
|
||||
* We defer startup of executing started tasks until we're sure we're ready for it
|
||||
* and the startup is completely done
|
||||
*/
|
||||
|
||||
@Override
|
||||
public int getPhase() {
|
||||
return ISmartLifecyclePhase.SCHEDULER_1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventListener(ContextRefreshedEvent.class)
|
||||
public void start() {
|
||||
myStopping.set(false);
|
||||
|
||||
try {
|
||||
ourLog.info("Starting task schedulers for context {}", myApplicationContext.getId());
|
||||
if (myLocalScheduler != null) {
|
||||
|
@ -164,9 +159,17 @@ public abstract class BaseSchedulerServiceImpl implements ISchedulerService, Sma
|
|||
ourLog.error("Failed to start scheduler", e);
|
||||
throw new ConfigurationException(Msg.code(1632) + "Failed to start scheduler", e);
|
||||
}
|
||||
|
||||
scheduleJobs();
|
||||
}
|
||||
|
||||
@Override
|
||||
private void scheduleJobs() {
|
||||
Collection<IHasScheduledJobs> values = myApplicationContext.getBeansOfType(IHasScheduledJobs.class).values();
|
||||
ourLog.info("Scheduling {} jobs in {}", values.size(), myApplicationContext.getId());
|
||||
values.forEach(t -> t.scheduleJobs(this));
|
||||
}
|
||||
|
||||
@EventListener(ContextClosedEvent.class)
|
||||
public void stop() {
|
||||
ourLog.info("Shutting down task scheduler...");
|
||||
|
||||
|
@ -175,11 +178,6 @@ public abstract class BaseSchedulerServiceImpl implements ISchedulerService, Sma
|
|||
myClusteredScheduler.shutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return !myStopping.get() && myLocalScheduler.isStarted() && myClusteredScheduler.isStarted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purgeAllScheduledJobsForUnitTest() throws SchedulerException {
|
||||
myLocalScheduler.clear();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ package ca.uhn.fhir.jpa.bulk.export.svc;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
||||
|
@ -33,6 +32,7 @@ import ca.uhn.fhir.jpa.entity.BulkExportCollectionEntity;
|
|||
import ca.uhn.fhir.jpa.entity.BulkExportCollectionFileEntity;
|
||||
import ca.uhn.fhir.jpa.entity.BulkExportJobEntity;
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
|
||||
|
@ -47,16 +47,16 @@ import org.springframework.data.domain.Pageable;
|
|||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Date;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class BulkDataExportJobSchedulingHelperImpl implements IBulkDataExportJobSchedulingHelper {
|
||||
public class BulkDataExportJobSchedulingHelperImpl implements IBulkDataExportJobSchedulingHelper, IHasScheduledJobs {
|
||||
private static final Logger ourLog = getLogger(BulkDataExportJobSchedulingHelperImpl.class);
|
||||
|
||||
@Autowired
|
||||
|
@ -72,30 +72,26 @@ public class BulkDataExportJobSchedulingHelperImpl implements IBulkDataExportJob
|
|||
private PlatformTransactionManager myTxManager;
|
||||
private TransactionTemplate myTxTemplate;
|
||||
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
|
||||
@Autowired
|
||||
private IBulkExportJobDao myBulkExportJobDao;
|
||||
|
||||
@Autowired
|
||||
private DaoConfig myDaoConfig;
|
||||
|
||||
@Autowired
|
||||
private FhirContext myContext;
|
||||
|
||||
@Autowired
|
||||
private BulkExportHelperService myBulkExportHelperSvc;
|
||||
|
||||
@PostConstruct
|
||||
public void start() {
|
||||
myTxTemplate = new TransactionTemplate(myTxManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
// job to cleanup unneeded BulkExportJobEntities that are persisted, but unwanted
|
||||
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
|
||||
jobDetail.setId(PurgeExpiredFilesJob.class.getName());
|
||||
jobDetail.setJobClass(PurgeExpiredFilesJob.class);
|
||||
mySchedulerService.scheduleClusteredJob(DateUtils.MILLIS_PER_HOUR, jobDetail);
|
||||
theSchedulerService.scheduleClusteredJob(DateUtils.MILLIS_PER_HOUR, jobDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,6 +35,7 @@ import ca.uhn.fhir.jpa.dao.data.IBulkImportJobFileDao;
|
|||
import ca.uhn.fhir.jpa.entity.BulkImportJobEntity;
|
||||
import ca.uhn.fhir.jpa.entity.BulkImportJobFileEntity;
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
|
@ -50,11 +51,11 @@ import org.springframework.data.domain.Pageable;
|
|||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
@ -63,7 +64,7 @@ import java.util.concurrent.Semaphore;
|
|||
|
||||
import static ca.uhn.fhir.batch2.jobs.importpull.BulkImportPullConfig.BULK_IMPORT_JOB_NAME;
|
||||
|
||||
public class BulkDataImportSvcImpl implements IBulkDataImportSvc {
|
||||
public class BulkDataImportSvcImpl implements IBulkDataImportSvc, IHasScheduledJobs {
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(BulkDataImportSvcImpl.class);
|
||||
private final Semaphore myRunningJobSemaphore = new Semaphore(1);
|
||||
@Autowired
|
||||
|
@ -74,9 +75,6 @@ public class BulkDataImportSvcImpl implements IBulkDataImportSvc {
|
|||
private PlatformTransactionManager myTxManager;
|
||||
private TransactionTemplate myTxTemplate;
|
||||
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
|
||||
@Autowired
|
||||
private IJobCoordinator myJobCoordinator;
|
||||
|
||||
|
@ -86,14 +84,19 @@ public class BulkDataImportSvcImpl implements IBulkDataImportSvc {
|
|||
@PostConstruct
|
||||
public void start() {
|
||||
myTxTemplate = new TransactionTemplate(myTxManager);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
// This job should be local so that each node in the cluster can pick up jobs
|
||||
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
|
||||
jobDetail.setId(ActivationJob.class.getName());
|
||||
jobDetail.setJobClass(ActivationJob.class);
|
||||
mySchedulerService.scheduleLocalJob(10 * DateUtils.MILLIS_PER_SECOND, jobDetail);
|
||||
theSchedulerService.scheduleLocalJob(10 * DateUtils.MILLIS_PER_SECOND, jobDetail);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String createNewJob(BulkImportJobJson theJobDescription, @Nonnull List<BulkImportJobFileJson> theInitialFiles) {
|
||||
|
@ -309,7 +312,6 @@ public class BulkDataImportSvcImpl implements IBulkDataImportSvc {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static class ActivationJob implements HapiJob {
|
||||
@Autowired
|
||||
private IBulkDataImportSvc myTarget;
|
||||
|
|
|
@ -9,7 +9,6 @@ import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
|||
import ca.uhn.fhir.interceptor.executor.InterceptorService;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.api.model.ExpungeOptions;
|
||||
import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
|
||||
import ca.uhn.fhir.jpa.binary.interceptor.BinaryStorageInterceptor;
|
||||
|
@ -46,6 +45,7 @@ import ca.uhn.fhir.jpa.dao.index.SearchParamWithInlineReferencesExtractor;
|
|||
import ca.uhn.fhir.jpa.dao.mdm.JpaMdmLinkImplFactory;
|
||||
import ca.uhn.fhir.jpa.dao.mdm.MdmLinkDaoJpaImpl;
|
||||
import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService;
|
||||
import ca.uhn.fhir.jpa.dao.validation.SearchParameterDaoValidator;
|
||||
import ca.uhn.fhir.jpa.delete.DeleteConflictFinderService;
|
||||
import ca.uhn.fhir.jpa.delete.DeleteConflictService;
|
||||
import ca.uhn.fhir.jpa.delete.ThreadSafeResourceDeleterSvc;
|
||||
|
@ -132,11 +132,11 @@ import ca.uhn.fhir.jpa.term.api.ITermReindexingSvc;
|
|||
import ca.uhn.fhir.jpa.term.config.TermCodeSystemConfig;
|
||||
import ca.uhn.fhir.jpa.util.MemoryCacheService;
|
||||
import ca.uhn.fhir.jpa.validation.ResourceLoaderImpl;
|
||||
import ca.uhn.fhir.jpa.dao.validation.SearchParameterDaoValidator;
|
||||
import ca.uhn.fhir.jpa.validation.ValidationSettings;
|
||||
import ca.uhn.fhir.mdm.dao.IMdmLinkDao;
|
||||
import ca.uhn.fhir.mdm.dao.IMdmLinkImplFactory;
|
||||
import ca.uhn.fhir.mdm.svc.MdmLinkExpandSvc;
|
||||
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.api.server.storage.IDeleteExpungeJobSubmitter;
|
||||
import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId;
|
||||
|
@ -287,8 +287,8 @@ public class JpaConfig {
|
|||
|
||||
@Bean(name = "myBinaryStorageInterceptor")
|
||||
@Lazy
|
||||
public BinaryStorageInterceptor binaryStorageInterceptor(DaoConfig theDaoConfig) {
|
||||
BinaryStorageInterceptor interceptor = new BinaryStorageInterceptor();
|
||||
public BinaryStorageInterceptor<? extends IPrimitiveDatatype<byte[]>> binaryStorageInterceptor(DaoConfig theDaoConfig, FhirContext theCtx) {
|
||||
BinaryStorageInterceptor<? extends IPrimitiveDatatype<byte[]>> interceptor = new BinaryStorageInterceptor<>(theCtx);
|
||||
interceptor.setAllowAutoInflateBinaries(theDaoConfig.isAllowAutoInflateBinaries());
|
||||
interceptor.setAutoInflateBinariesMaximumSize(theDaoConfig.getAutoInflateBinariesMaximumBytes());
|
||||
return interceptor;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR JPA Server
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
|
@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.search;
|
|||
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.jpa.search.cache.ISearchCacheSvc;
|
||||
|
@ -30,8 +31,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import static ca.uhn.fhir.jpa.search.cache.DatabaseSearchCacheSvcImpl.SEARCH_CLEANUP_JOB_INTERVAL_MILLIS;
|
||||
|
||||
/**
|
||||
|
@ -42,14 +41,12 @@ import static ca.uhn.fhir.jpa.search.cache.DatabaseSearchCacheSvcImpl.SEARCH_CLE
|
|||
// it in BaseConfig. This is so that we can override the definition
|
||||
// in Smile.
|
||||
//
|
||||
public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc {
|
||||
public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc, IHasScheduledJobs {
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StaleSearchDeletingSvcImpl.class);
|
||||
@Autowired
|
||||
private DaoConfig myDaoConfig;
|
||||
@Autowired
|
||||
private ISearchCacheSvc mySearchCacheSvc;
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.NEVER)
|
||||
|
@ -57,12 +54,12 @@ public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc {
|
|||
mySearchCacheSvc.pollForStaleSearchesAndDeleteThem();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void scheduleJob() {
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
|
||||
jobDetail.setId(getClass().getName());
|
||||
jobDetail.setJobClass(Job.class);
|
||||
mySchedulerService.scheduleClusteredJob(SEARCH_CLEANUP_JOB_INTERVAL_MILLIS, jobDetail);
|
||||
theSchedulerService.scheduleClusteredJob(SEARCH_CLEANUP_JOB_INTERVAL_MILLIS, jobDetail);
|
||||
}
|
||||
|
||||
public static class Job implements HapiJob {
|
||||
|
|
|
@ -21,8 +21,8 @@ package ca.uhn.fhir.jpa.search.reindex;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.batch2.model.JobInstanceStartRequest;
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
|
||||
|
@ -32,6 +32,7 @@ import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
|
|||
import ca.uhn.fhir.jpa.entity.ResourceReindexJobEntity;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
@ -53,6 +54,7 @@ import org.springframework.data.domain.Slice;
|
|||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionCallback;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
|
@ -62,7 +64,6 @@ import javax.persistence.EntityManager;
|
|||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.PersistenceContextType;
|
||||
import javax.persistence.Query;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -84,7 +85,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
|||
* @deprecated Use the Batch2 {@link ca.uhn.fhir.batch2.api.IJobCoordinator#startInstance(JobInstanceStartRequest)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class ResourceReindexingSvcImpl implements IResourceReindexingSvc {
|
||||
public class ResourceReindexingSvcImpl implements IResourceReindexingSvc, IHasScheduledJobs {
|
||||
|
||||
private static final Date BEGINNING_OF_TIME = new Date(0);
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(ResourceReindexingSvcImpl.class);
|
||||
|
@ -112,8 +113,6 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc {
|
|||
@Autowired
|
||||
private ISearchParamRegistry mySearchParamRegistry;
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
@Autowired
|
||||
private ResourceReindexer myResourceReindexer;
|
||||
|
||||
@VisibleForTesting
|
||||
|
@ -130,7 +129,6 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc {
|
|||
public void start() {
|
||||
myTxTemplate = new TransactionTemplate(myTxManager);
|
||||
initExecutor();
|
||||
scheduleJob();
|
||||
}
|
||||
|
||||
public void initExecutor() {
|
||||
|
@ -145,12 +143,12 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
public void scheduleJob() {
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
|
||||
jobDetail.setId(getClass().getName());
|
||||
jobDetail.setJobClass(Job.class);
|
||||
mySchedulerService.scheduleClusteredJob(10 * DateUtils.MILLIS_PER_SECOND, jobDetail);
|
||||
theSchedulerService.scheduleClusteredJob(10 * DateUtils.MILLIS_PER_SECOND, jobDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,15 +20,16 @@ package ca.uhn.fhir.jpa.search.warm;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.api.model.WarmCacheEntry;
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
|
||||
|
@ -50,7 +51,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
@Component
|
||||
public class CacheWarmingSvcImpl implements ICacheWarmingSvc {
|
||||
public class CacheWarmingSvcImpl implements ICacheWarmingSvc, IHasScheduledJobs {
|
||||
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(CacheWarmingSvcImpl.class);
|
||||
@Autowired
|
||||
|
@ -62,8 +63,6 @@ public class CacheWarmingSvcImpl implements ICacheWarmingSvc {
|
|||
private DaoRegistry myDaoRegistry;
|
||||
@Autowired
|
||||
private MatchUrlService myMatchUrlService;
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
|
||||
@Override
|
||||
public synchronized void performWarmingPass() {
|
||||
|
@ -109,14 +108,14 @@ public class CacheWarmingSvcImpl implements ICacheWarmingSvc {
|
|||
@PostConstruct
|
||||
public void start() {
|
||||
initCacheMap();
|
||||
scheduleJob();
|
||||
}
|
||||
|
||||
public void scheduleJob() {
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
|
||||
jobDetail.setId(getClass().getName());
|
||||
jobDetail.setJobClass(Job.class);
|
||||
mySchedulerService.scheduleClusteredJob(10 * DateUtils.MILLIS_PER_SECOND, jobDetail);
|
||||
theSchedulerService.scheduleClusteredJob(10 * DateUtils.MILLIS_PER_SECOND, jobDetail);
|
||||
}
|
||||
|
||||
public static class Job implements HapiJob {
|
||||
|
|
|
@ -35,6 +35,7 @@ import ca.uhn.fhir.jpa.entity.TermConcept;
|
|||
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc;
|
||||
|
@ -58,7 +59,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
|
@ -73,7 +73,7 @@ import java.util.function.Supplier;
|
|||
import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_DELETE_JOB_NAME;
|
||||
import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME;
|
||||
|
||||
public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc {
|
||||
public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc, IHasScheduledJobs {
|
||||
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(TermDeferredStorageSvcImpl.class);
|
||||
private static final long SAVE_ALL_DEFERRED_WARN_MINUTES = 1;
|
||||
|
@ -105,8 +105,6 @@ public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc {
|
|||
@Autowired
|
||||
private ITermConceptParentChildLinkDao myConceptParentChildLinkDao;
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
@Autowired
|
||||
private ITermVersionAdapterSvc myTerminologyVersionAdapterSvc;
|
||||
|
||||
@Autowired
|
||||
|
@ -282,9 +280,9 @@ public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc {
|
|||
Duration.of(SAVE_ALL_DEFERRED_ERROR_MINUTES, ChronoUnit.MINUTES));
|
||||
}
|
||||
|
||||
// Don't include executing jobs here since there's no point in thrashing over and over
|
||||
// in a busy wait while we wait for batch2 job processes to finish
|
||||
while (!isStorageQueueEmpty(false)) {
|
||||
// Don't include executing jobs here since there's no point in thrashing over and over
|
||||
// in a busy wait while we wait for batch2 job processes to finish
|
||||
while (!isStorageQueueEmpty(false)) {
|
||||
if (myAllowDeferredTasksTimeout) {
|
||||
if (timeoutManager.checkTimeout()) {
|
||||
ourLog.info(toString());
|
||||
|
@ -464,18 +462,6 @@ public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc {
|
|||
return !myDeferredConceptMaps.isEmpty();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void scheduleJob() {
|
||||
// TODO KHS what does this mean?
|
||||
// Register scheduled job to save deferred concepts
|
||||
// In the future it would be great to make this a cluster-aware task somehow
|
||||
ScheduledJobDefinition jobDefinition = new ScheduledJobDefinition();
|
||||
jobDefinition.setId(Job.class.getName());
|
||||
jobDefinition.setJobClass(Job.class);
|
||||
mySchedulerService.scheduleLocalJob(5000, jobDefinition);
|
||||
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void setTransactionManagerForUnitTest(PlatformTransactionManager theTxManager) {
|
||||
myTransactionMgr = theTxManager;
|
||||
|
@ -496,8 +482,11 @@ public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc {
|
|||
void setCodeSystemVersionDaoForUnitTest(ITermCodeSystemVersionDao theCodeSystemVersionDao) {
|
||||
myCodeSystemVersionDao = theCodeSystemVersionDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disallowDeferredTaskTimeout() { myAllowDeferredTasksTimeout = false; }
|
||||
public void disallowDeferredTaskTimeout() {
|
||||
myAllowDeferredTasksTimeout = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@VisibleForTesting
|
||||
|
@ -515,6 +504,17 @@ public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc {
|
|||
myDeferredCodeSystemVersionsDeletions.add(theCodeSystemVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
// TODO KHS what does this mean?
|
||||
// Register scheduled job to save deferred concepts
|
||||
// In the future it would be great to make this a cluster-aware task somehow
|
||||
ScheduledJobDefinition jobDefinition = new ScheduledJobDefinition();
|
||||
jobDefinition.setId(Job.class.getName());
|
||||
jobDefinition.setJobClass(Job.class);
|
||||
theSchedulerService.scheduleLocalJob(5000, jobDefinition);
|
||||
}
|
||||
|
||||
public static class Job implements HapiJob {
|
||||
@Autowired
|
||||
private ITermDeferredStorageSvc myTerminologySvc;
|
||||
|
|
|
@ -65,6 +65,7 @@ import ca.uhn.fhir.jpa.model.dao.JpaPid;
|
|||
import ca.uhn.fhir.jpa.model.entity.ForcedId;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.jpa.model.util.JpaConstants;
|
||||
|
@ -192,7 +193,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
|||
import static org.apache.commons.lang3.StringUtils.lowerCase;
|
||||
import static org.apache.commons.lang3.StringUtils.startsWithIgnoreCase;
|
||||
|
||||
public class TermReadSvcImpl implements ITermReadSvc {
|
||||
public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
|
||||
public static final int DEFAULT_FETCH_SIZE = 250;
|
||||
public static final int DEFAULT_MASS_INDEXER_OBJECT_LOADING_THREADS = 2;
|
||||
// doesn't seem to be much gain by using more threads than this value
|
||||
|
@ -248,8 +249,6 @@ public class TermReadSvcImpl implements ITermReadSvc {
|
|||
private ITermValueSetConceptViewDao myTermValueSetConceptViewDao;
|
||||
@Autowired
|
||||
private ITermValueSetConceptViewOracleDao myTermValueSetConceptViewOracleDao;
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
@Autowired(required = false)
|
||||
private ITermDeferredStorageSvc myDeferredStorageSvc;
|
||||
@Autowired
|
||||
|
@ -1887,16 +1886,16 @@ public class TermReadSvcImpl implements ITermReadSvc {
|
|||
RuleBasedTransactionAttribute rules = new RuleBasedTransactionAttribute();
|
||||
rules.getRollbackRules().add(new NoRollbackRuleAttribute(ExpansionTooCostlyException.class));
|
||||
myTxTemplate = new TransactionTemplate(myTransactionManager, rules);
|
||||
scheduleJob();
|
||||
}
|
||||
|
||||
public void scheduleJob() {
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
// Register scheduled job to pre-expand ValueSets
|
||||
// In the future it would be great to make this a cluster-aware task somehow
|
||||
ScheduledJobDefinition vsJobDefinition = new ScheduledJobDefinition();
|
||||
vsJobDefinition.setId(getClass().getName());
|
||||
vsJobDefinition.setJobClass(Job.class);
|
||||
mySchedulerService.scheduleClusteredJob(10 * DateUtils.MILLIS_PER_MINUTE, vsJobDefinition);
|
||||
theSchedulerService.scheduleClusteredJob(10 * DateUtils.MILLIS_PER_MINUTE, vsJobDefinition);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,6 +24,7 @@ import ca.uhn.fhir.jpa.dao.data.ITermConceptDao;
|
|||
import ca.uhn.fhir.jpa.dao.data.ITermConceptParentChildLinkDao;
|
||||
import ca.uhn.fhir.jpa.entity.TermConcept;
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc;
|
||||
|
@ -45,13 +46,12 @@ import org.springframework.transaction.TransactionStatus;
|
|||
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
||||
public class TermReindexingSvcImpl implements ITermReindexingSvc {
|
||||
public class TermReindexingSvcImpl implements ITermReindexingSvc, IHasScheduledJobs {
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(TermReindexingSvcImpl.class);
|
||||
private static boolean ourForceSaveDeferredAlwaysForUnitTest;
|
||||
@Autowired
|
||||
|
@ -64,8 +64,6 @@ public class TermReindexingSvcImpl implements ITermReindexingSvc {
|
|||
@Autowired
|
||||
private ITermDeferredStorageSvc myDeferredStorageSvc;
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
@Autowired
|
||||
private TermConceptDaoSvc myTermConceptDaoSvc;
|
||||
|
||||
@Override
|
||||
|
@ -147,15 +145,15 @@ public class TermReindexingSvcImpl implements ITermReindexingSvc {
|
|||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void scheduleJob() {
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
// TODO KHS what does this mean?
|
||||
// Register scheduled job to save deferred concepts
|
||||
// In the future it would be great to make this a cluster-aware task somehow
|
||||
ScheduledJobDefinition jobDefinition = new ScheduledJobDefinition();
|
||||
jobDefinition.setId(this.getClass().getName());
|
||||
jobDefinition.setJobClass(Job.class);
|
||||
mySchedulerService.scheduleLocalJob(DateUtils.MILLIS_PER_MINUTE, jobDefinition);
|
||||
theSchedulerService.scheduleLocalJob(DateUtils.MILLIS_PER_MINUTE, jobDefinition);
|
||||
}
|
||||
|
||||
public static class Job implements HapiJob {
|
||||
|
|
|
@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.util;
|
|||
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
|
@ -32,12 +33,11 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class ResourceCountCache {
|
||||
public class ResourceCountCache implements IHasScheduledJobs {
|
||||
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(ResourceCountCache.class);
|
||||
private static Long ourNowForUnitTest;
|
||||
|
@ -45,8 +45,6 @@ public class ResourceCountCache {
|
|||
private volatile long myCacheMillis;
|
||||
private AtomicReference<Map<String, Long>> myCapabilityStatement = new AtomicReference<>();
|
||||
private long myLastFetched;
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -92,12 +90,12 @@ public class ResourceCountCache {
|
|||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void scheduleJob() {
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
|
||||
jobDetail.setId(getClass().getName());
|
||||
jobDetail.setJobClass(Job.class);
|
||||
mySchedulerService.scheduleLocalJob(10 * DateUtils.MILLIS_PER_MINUTE, jobDetail);
|
||||
theSchedulerService.scheduleLocalJob(10 * DateUtils.MILLIS_PER_MINUTE, jobDetail);
|
||||
}
|
||||
|
||||
public static class Job implements HapiJob {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.cache;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
|
@ -31,9 +32,9 @@ import org.quartz.JobExecutionContext;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -50,7 +51,7 @@ import java.util.List;
|
|||
* if any entries in the new cache are different from the last time that cache was loaded.
|
||||
*/
|
||||
@Service
|
||||
public class ResourceChangeListenerCacheRefresherImpl implements IResourceChangeListenerCacheRefresher {
|
||||
public class ResourceChangeListenerCacheRefresherImpl implements IResourceChangeListenerCacheRefresher, IHasScheduledJobs {
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(ResourceChangeListenerCacheRefresherImpl.class);
|
||||
|
||||
/**
|
||||
|
@ -58,20 +59,18 @@ public class ResourceChangeListenerCacheRefresherImpl implements IResourceChange
|
|||
*/
|
||||
static long LOCAL_REFRESH_INTERVAL_MS = 10 * DateUtils.MILLIS_PER_SECOND;
|
||||
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
@Autowired
|
||||
private IResourceVersionSvc myResourceVersionSvc;
|
||||
@Autowired
|
||||
private ResourceChangeListenerRegistryImpl myResourceChangeListenerRegistry;
|
||||
private boolean myStopping = false;
|
||||
|
||||
@EventListener(classes = {ContextRefreshedEvent.class})
|
||||
@Order
|
||||
public void start() {
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
|
||||
jobDetail.setId(getClass().getName());
|
||||
jobDetail.setJobClass(Job.class);
|
||||
mySchedulerService.scheduleLocalJob(LOCAL_REFRESH_INTERVAL_MS, jobDetail);
|
||||
theSchedulerService.scheduleLocalJob(LOCAL_REFRESH_INTERVAL_MS, jobDetail);
|
||||
}
|
||||
|
||||
public static class Job implements HapiJob {
|
||||
|
@ -106,11 +105,6 @@ public class ResourceChangeListenerCacheRefresherImpl implements IResourceChange
|
|||
return retval;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void setSchedulerService(ISchedulerService theSchedulerService) {
|
||||
mySchedulerService = theSchedulerService;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void setResourceChangeListenerRegistry(ResourceChangeListenerRegistryImpl theResourceChangeListenerRegistry) {
|
||||
myResourceChangeListenerRegistry = theResourceChangeListenerRegistry;
|
||||
|
@ -121,11 +115,26 @@ public class ResourceChangeListenerCacheRefresherImpl implements IResourceChange
|
|||
myResourceVersionSvc = theResourceVersionSvc;
|
||||
}
|
||||
|
||||
|
||||
@EventListener(ContextRefreshedEvent.class)
|
||||
public void start() {
|
||||
myStopping = false;
|
||||
}
|
||||
|
||||
@EventListener(ContextClosedEvent.class)
|
||||
public void shutdown() {
|
||||
myStopping = true;
|
||||
}
|
||||
|
||||
public boolean isStopping() {
|
||||
return myStopping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceChangeResult refreshCacheAndNotifyListener(IResourceChangeListenerCache theCache) {
|
||||
ResourceChangeResult retVal = new ResourceChangeResult();
|
||||
if (mySchedulerService.isStopping()) {
|
||||
ourLog.info("Scheduler service is stopping, aborting cache refresh");
|
||||
if (isStopping()) {
|
||||
ourLog.info("Context is stopping, aborting cache refresh");
|
||||
return retVal;
|
||||
}
|
||||
if (!myResourceChangeListenerRegistry.contains(theCache)) {
|
||||
|
|
|
@ -49,8 +49,6 @@ class ResourceChangeListenerRegistryImplTest {
|
|||
@Autowired
|
||||
ResourceChangeListenerCacheFactory myResourceChangeListenerCacheFactory;
|
||||
@MockBean
|
||||
private ISchedulerService mySchedulerService;
|
||||
@MockBean
|
||||
private IResourceVersionSvc myResourceVersionSvc;
|
||||
@MockBean
|
||||
private ResourceChangeListenerCacheRefresherImpl myResourceChangeListenerCacheRefresher;
|
||||
|
|
|
@ -92,8 +92,6 @@ public class SearchParamRegistryImplTest {
|
|||
@MockBean
|
||||
private IResourceVersionSvc myResourceVersionSvc;
|
||||
@MockBean
|
||||
private ISchedulerService mySchedulerService;
|
||||
@MockBean
|
||||
private ISearchParamProvider mySearchParamProvider;
|
||||
@MockBean
|
||||
private IInterceptorService myInterceptorBroadcaster;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@ import org.hl7.fhir.r4.model.Subscription;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
@ -68,8 +71,6 @@ public class SubscriptionLoader implements IResourceChangeListener {
|
|||
DaoRegistry myDaoRegistry;
|
||||
private Semaphore mySyncSubscriptionsSemaphore = new Semaphore(1);
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
@Autowired
|
||||
private SubscriptionActivatingSubscriber mySubscriptionActivatingInterceptor;
|
||||
@Autowired
|
||||
private ISearchParamRegistry mySearchParamRegistry;
|
||||
|
@ -80,6 +81,7 @@ public class SubscriptionLoader implements IResourceChangeListener {
|
|||
|
||||
private SearchParameterMap mySearchParameterMap;
|
||||
private SystemRequestDetails mySystemRequestDetails;
|
||||
private boolean myStopping;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -144,7 +146,7 @@ public class SubscriptionLoader implements IResourceChangeListener {
|
|||
}
|
||||
|
||||
private int doSyncSubscriptions() {
|
||||
if (mySchedulerService.isStopping()) {
|
||||
if (isStopping()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -165,6 +167,20 @@ public class SubscriptionLoader implements IResourceChangeListener {
|
|||
}
|
||||
}
|
||||
|
||||
@EventListener(ContextRefreshedEvent.class)
|
||||
public void start() {
|
||||
myStopping = false;
|
||||
}
|
||||
|
||||
@EventListener(ContextClosedEvent.class)
|
||||
public void shutdown() {
|
||||
myStopping = true;
|
||||
}
|
||||
|
||||
private boolean isStopping() {
|
||||
return myStopping;
|
||||
}
|
||||
|
||||
private IFhirResourceDao<?> getSubscriptionDao() {
|
||||
return myDaoRegistry.getSubscriptionDao();
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
|||
import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc;
|
||||
import ca.uhn.fhir.jpa.api.svc.ISearchSvc;
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
|
||||
import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.IResourceModifiedConsumer;
|
||||
|
@ -41,6 +41,7 @@ import ca.uhn.fhir.model.dstu2.valueset.ResourceTypeEnum;
|
|||
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||
import ca.uhn.fhir.rest.api.CacheControlDirective;
|
||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
|
||||
import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
|
@ -86,7 +87,7 @@ import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
|||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
|
||||
public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc {
|
||||
public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc, IHasScheduledJobs {
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(SubscriptionTriggeringSvcImpl.class);
|
||||
private static final int DEFAULT_MAX_SUBMIT = 10000;
|
||||
private final List<SubscriptionTriggeringJobDetails> myActiveJobs = new ArrayList<>();
|
||||
|
@ -104,8 +105,6 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc
|
|||
private IResourceModifiedConsumer myResourceModifiedConsumer;
|
||||
private int myMaxSubmitPerPass = DEFAULT_MAX_SUBMIT;
|
||||
private ExecutorService myExecutorService;
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
|
||||
@Autowired
|
||||
private ISearchSvc mySearchService;
|
||||
|
@ -449,7 +448,6 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc
|
|||
@PostConstruct
|
||||
public void start() {
|
||||
createExecutorService();
|
||||
scheduleJob();
|
||||
}
|
||||
|
||||
private void createExecutorService() {
|
||||
|
@ -485,13 +483,14 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc
|
|||
rejectedExecutionHandler);
|
||||
}
|
||||
|
||||
private void scheduleJob() {
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
|
||||
jobDetail.setId(getClass().getName());
|
||||
jobDetail.setJobClass(Job.class);
|
||||
// Currently jobs ae kept in a local ArrayList so this should be a local job, and
|
||||
// it can fire frequently without adding load
|
||||
mySchedulerService.scheduleLocalJob(5 * DateUtils.MILLIS_PER_SECOND, jobDetail);
|
||||
theSchedulerService.scheduleLocalJob(5 * DateUtils.MILLIS_PER_SECOND, jobDetail);
|
||||
}
|
||||
|
||||
public int getActiveJobCount() {
|
||||
|
|
|
@ -47,8 +47,6 @@ public class DaoSubscriptionMatcherTest {
|
|||
@MockBean
|
||||
private ISearchParamProvider mySearchParamProvider;
|
||||
@MockBean
|
||||
private ISchedulerService mySchedulerService;
|
||||
@MockBean
|
||||
private IInterceptorService myInterceptorService;
|
||||
@MockBean
|
||||
private DaoRegistry myDaoRegistry;
|
||||
|
|
|
@ -130,8 +130,6 @@ public class SubscriptionLoaderTest {
|
|||
.thenReturn(getSubscriptionList(
|
||||
Collections.singletonList(subscription)
|
||||
));
|
||||
when(mySchedulerSvc.isStopping())
|
||||
.thenReturn(false);
|
||||
|
||||
when(mySubscriptionActivatingInterceptor.activateSubscriptionIfRequired(any(IBaseResource.class)))
|
||||
.thenReturn(false);
|
||||
|
|
|
@ -63,8 +63,6 @@ public class WebsocketConnectionValidatorTest {
|
|||
@MockBean
|
||||
InMemoryResourceMatcher myInMemoryResourceMatcher;
|
||||
@MockBean
|
||||
ISchedulerService mySchedulerService;
|
||||
@MockBean
|
||||
SubscriptionRegistry mySubscriptionRegistry;
|
||||
@MockBean
|
||||
ISearchParamRegistry mySearchParamRegistry;
|
||||
|
|
|
@ -39,8 +39,6 @@ public class SubscriptionSubmitInterceptorLoaderTest {
|
|||
@MockBean
|
||||
private ISearchParamProvider mySearchParamProvider;
|
||||
@MockBean
|
||||
private ISchedulerService mySchedulerService;
|
||||
@MockBean
|
||||
private IInterceptorService myInterceptorService;
|
||||
@MockBean
|
||||
private IValidationSupport myValidationSupport;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -81,8 +81,6 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
|||
@Autowired
|
||||
private ISubscriptionTriggeringSvc mySubscriptionTriggeringSvc;
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
@Autowired
|
||||
private IInterceptorService myInterceptorService;
|
||||
|
||||
@AfterEach
|
||||
|
@ -125,8 +123,6 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
|||
ourCreatedPatients.clear();
|
||||
ourUpdatedPatients.clear();
|
||||
ourContentTypes.clear();
|
||||
|
||||
mySchedulerService.logStatusForUnitTest();
|
||||
}
|
||||
|
||||
private Subscription createSubscription(String theCriteria, String thePayload, String theEndpoint) throws InterruptedException {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import static org.hamcrest.Matchers.not;
|
|||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
|
||||
|
@ -60,8 +61,8 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
|
|||
super.after();
|
||||
myStorageSvc.setMinimumBinarySize(0);
|
||||
myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled());
|
||||
myBinaryStorageInterceptor.setAutoInflateBinariesMaximumSize(new BinaryStorageInterceptor().getAutoInflateBinariesMaximumSize());
|
||||
myBinaryStorageInterceptor.setAllowAutoInflateBinaries(new BinaryStorageInterceptor().isAllowAutoInflateBinaries());
|
||||
myBinaryStorageInterceptor.setAutoInflateBinariesMaximumSize(new BinaryStorageInterceptor<>(myFhirContext).getAutoInflateBinariesMaximumSize());
|
||||
myBinaryStorageInterceptor.setAllowAutoInflateBinaries(new BinaryStorageInterceptor<>(myFhirContext).isAllowAutoInflateBinaries());
|
||||
|
||||
MemoryBinaryStorageSvcImpl binaryStorageSvc = (MemoryBinaryStorageSvcImpl) myBinaryStorageSvc;
|
||||
binaryStorageSvc.clear();
|
||||
|
@ -100,7 +101,7 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
|
|||
Binary binary = new Binary();
|
||||
binary.setContentType("application/octet-stream");
|
||||
binary.setData(SOME_BYTES);
|
||||
DaoMethodOutcome outcome = myBinaryDao.create(binary);
|
||||
DaoMethodOutcome outcome = myBinaryDao.create(binary, mySrd);
|
||||
|
||||
// Make sure it was externalized
|
||||
IIdType id = outcome.getId().toUnqualifiedVersionless();
|
||||
|
@ -124,7 +125,7 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
|
|||
Binary binary = new Binary();
|
||||
binary.setContentType("application/octet-stream");
|
||||
binary.setData(SOME_BYTES);
|
||||
DaoMethodOutcome outcome = myBinaryDao.create(binary);
|
||||
DaoMethodOutcome outcome = myBinaryDao.create(binary, mySrd);
|
||||
|
||||
// Make sure it was externalized
|
||||
IIdType id = outcome.getId().toUnqualifiedVersionless();
|
||||
|
@ -342,7 +343,7 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
|
|||
// Now read it back and make sure it was de-externalized
|
||||
Binary output = myBinaryDao.read(id, mySrd);
|
||||
assertEquals("application/octet-stream", output.getContentType());
|
||||
assertEquals(null, output.getData());
|
||||
assertNull(output.getData());
|
||||
assertNotNull(output.getDataElement().getExtensionByUrl(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID).getValue());
|
||||
|
||||
}
|
||||
|
|
|
@ -84,8 +84,6 @@ public class ResourceReindexingSvcImplTest extends BaseJpaTest {
|
|||
private ISearchParamRegistry mySearchParamRegistry;
|
||||
@Mock
|
||||
private TransactionStatus myTxStatus;
|
||||
@Mock
|
||||
private ISchedulerService mySchedulerService;
|
||||
@InjectMocks
|
||||
private final ResourceReindexer myResourceReindexer = new ResourceReindexer(ourFhirContext);
|
||||
@InjectMocks
|
||||
|
|
|
@ -209,7 +209,6 @@ public class GiantTransactionPerfTest {
|
|||
myResourceVersionSvc = new MockResourceVersionSvc();
|
||||
|
||||
myResourceChangeListenerCacheRefresher = new ResourceChangeListenerCacheRefresherImpl();
|
||||
myResourceChangeListenerCacheRefresher.setSchedulerService(new MockSchedulerSvc());
|
||||
myResourceChangeListenerCacheRefresher.setResourceVersionSvc(myResourceVersionSvc);
|
||||
|
||||
when(myResourceChangeListenerCacheFactory.newResourceChangeListenerCache(any(), any(), any(), anyLong())).thenAnswer(t -> {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ca.uhn.fhirtest.interceptor;
|
||||
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||
|
@ -31,7 +32,7 @@ import java.util.UUID;
|
|||
import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
||||
public class AnalyticsInterceptor extends InterceptorAdapter {
|
||||
public class AnalyticsInterceptor extends InterceptorAdapter implements IHasScheduledJobs {
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(AnalyticsInterceptor.class);
|
||||
private final LinkedList<AnalyticsEvent> myEventBuffer = new LinkedList<>();
|
||||
private String myAnalyticsTid;
|
||||
|
@ -40,8 +41,6 @@ public class AnalyticsInterceptor extends InterceptorAdapter {
|
|||
private HttpClient myHttpClient;
|
||||
private long mySubmitPeriod = 60000;
|
||||
private int mySubmitThreshold = 1000;
|
||||
@Autowired
|
||||
private ISchedulerService mySchedulerService;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -55,12 +54,12 @@ public class AnalyticsInterceptor extends InterceptorAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void start() {
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
|
||||
jobDetail.setId(getClass().getName());
|
||||
jobDetail.setJobClass(Job.class);
|
||||
mySchedulerService.scheduleLocalJob(5000, jobDetail);
|
||||
theSchedulerService.scheduleLocalJob(5000, jobDetail);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.mdm.api;
|
|||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR JPA Server - Master Data Management
|
||||
* HAPI FHIR - Master Data Management
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<artifactId>hapi-fhir-serviceloaders</artifactId>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<artifactId>hapi-fhir-serviceloaders</artifactId>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-caching-api</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<artifactId>hapi-fhir-serviceloaders</artifactId>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hapi-fhir-spring-boot-sample-client-okhttp</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hapi-fhir-spring-boot-sample-server-jersey</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-spring-boot</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import ca.uhn.fhir.batch2.model.JobInstance;
|
|||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.jpa.batch.log.Logs;
|
||||
import ca.uhn.fhir.jpa.model.sched.HapiJob;
|
||||
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
@ -39,7 +40,6 @@ import org.slf4j.Logger;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -75,7 +75,7 @@ import java.util.concurrent.TimeUnit;
|
|||
* exactly one chunk, then the maintenance task will be triggered earlier than scheduled by the step executor.
|
||||
* </p>
|
||||
*/
|
||||
public class JobMaintenanceServiceImpl implements IJobMaintenanceService {
|
||||
public class JobMaintenanceServiceImpl implements IJobMaintenanceService, IHasScheduledJobs {
|
||||
private static final Logger ourLog = Logs.getBatchTroubleshootingLog();
|
||||
|
||||
public static final int INSTANCES_PER_PASS = 100;
|
||||
|
@ -111,8 +111,8 @@ public class JobMaintenanceServiceImpl implements IJobMaintenanceService {
|
|||
myJobExecutorSvc = theExecutor;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void start() {
|
||||
@Override
|
||||
public void scheduleJobs(ISchedulerService theSchedulerService) {
|
||||
mySchedulerService.scheduleClusteredJob(DateUtils.MILLIS_PER_MINUTE, buildJobDefinition());
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
<version>6.3.7-SNAPSHOT</version>
|
||||
<version>6.3.8-SNAPSHOT</version>
|
||||
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.common;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.config;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.config;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -4,7 +4,7 @@ package ca.uhn.fhir.cr.config;
|
|||
* #%L
|
||||
* HAPI FHIR - Clinical Reasoning
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue