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