This commit is contained in:
Anthony Sute 2019-11-11 17:22:50 -05:00
commit b27af398b4
6 changed files with 27 additions and 11 deletions

View File

@ -28,7 +28,7 @@ import java.util.concurrent.LinkedBlockingQueue;
public class LinkedBlockingQueueSubscribableChannelFactory implements ISubscribableChannelFactory {
@Override
public SubscribableChannel createSubscribableChannel(String theChannelName, int theConcurrentConsumers) {
public SubscribableChannel createSubscribableChannel(String theChannelName, Class theMessageType, int theConcurrentConsumers) {
return new LinkedBlockingQueueSubscribableChannel(new LinkedBlockingQueue<>(SubscriptionConstants.DELIVERY_EXECUTOR_QUEUE_SIZE), theChannelName + "-%d", theConcurrentConsumers);
}

View File

@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.subscription.module.channel;
import org.springframework.messaging.SubscribableChannel;
public interface ISubscribableChannelFactory {
SubscribableChannel createSubscribableChannel(String theChannelName, int theConcurrentConsumers);
SubscribableChannel createSubscribableChannel(String theChannelName, Class theMessageType, int theConcurrentConsumers);
int getDeliveryChannelConcurrentConsumers();

View File

@ -20,6 +20,8 @@ package ca.uhn.fhir.jpa.subscription.module.channel;
* #L%
*/
import ca.uhn.fhir.jpa.subscription.module.ResourceModifiedMessage;
import ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.stereotype.Component;
@ -35,10 +37,10 @@ public class SubscriptionChannelFactory {
}
public SubscribableChannel newDeliveryChannel(String theChannelName) {
return mySubscribableChannelFactory.createSubscribableChannel(theChannelName, mySubscribableChannelFactory.getDeliveryChannelConcurrentConsumers());
return mySubscribableChannelFactory.createSubscribableChannel(theChannelName, ResourceDeliveryMessage.class, mySubscribableChannelFactory.getDeliveryChannelConcurrentConsumers());
}
public SubscribableChannel newMatchingChannel(String theChannelName) {
return mySubscribableChannelFactory.createSubscribableChannel(theChannelName, mySubscribableChannelFactory.getMatchingChannelConcurrentConsumers());
return mySubscribableChannelFactory.createSubscribableChannel(theChannelName, ResourceModifiedMessage.class, mySubscribableChannelFactory.getMatchingChannelConcurrentConsumers());
}
}

View File

@ -48,9 +48,11 @@ public class PointcutLatch implements IAnonymousInterceptor, IPointcutLatch {
private final AtomicReference<CountDownLatch> myCountdownLatch = new AtomicReference<>();
private final AtomicReference<List<String>> myFailures = new AtomicReference<>();
private final AtomicReference<List<HookParams>> myCalledWith = new AtomicReference<>();
private final Pointcut myPointcut;
private int myDefaultTimeoutSeconds = DEFAULT_TIMEOUT_SECONDS;
private final Pointcut myPointcut;
private int myInitialCount;
public PointcutLatch(Pointcut thePointcut) {
this.name = thePointcut.name();
myPointcut = thePointcut;
@ -58,7 +60,12 @@ public class PointcutLatch implements IAnonymousInterceptor, IPointcutLatch {
public PointcutLatch(String theName) {
this.name = theName;
myPointcut = null;
myPointcut = null;
}
public PointcutLatch setDefaultTimeoutSeconds(int theDefaultTimeoutSeconds) {
myDefaultTimeoutSeconds = theDefaultTimeoutSeconds;
return this;
}
@Override
@ -91,14 +98,14 @@ public class PointcutLatch implements IAnonymousInterceptor, IPointcutLatch {
@Override
public List<HookParams> awaitExpected() throws InterruptedException {
return awaitExpectedWithTimeout(DEFAULT_TIMEOUT_SECONDS);
return awaitExpectedWithTimeout(myDefaultTimeoutSeconds);
}
public List<HookParams> awaitExpectedWithTimeout(int timeoutSecond) throws InterruptedException {
List<HookParams> retval = myCalledWith.get();
try {
CountDownLatch latch = myCountdownLatch.get();
Validate.notNull(latch, getName() + " awaitExpected() called before setExpected() called.");
Validate.notNull(latch, getName() + " awaitExpected() called before setExpected() called.");
if (!latch.await(timeoutSecond, TimeUnit.SECONDS)) {
throw new AssertionError(getName() + " timed out waiting " + timeoutSecond + " seconds for latch to countdown from " + myInitialCount + " to 0. Is " + latch.getCount() + ".");
}
@ -145,7 +152,7 @@ public class PointcutLatch implements IAnonymousInterceptor, IPointcutLatch {
@Override
public void invoke(Pointcut thePointcut, HookParams theArgs) {
CountDownLatch latch = myCountdownLatch.get();
CountDownLatch latch = myCountdownLatch.get();
if (latch == null) {
throw new PointcutLatchException("invoke() called outside of setExpectedCount() .. awaitExpected(). Probably got more invocations than expected or clear() was called before invoke() arrived.", theArgs);
} else if (latch.getCount() <= 0) {

View File

@ -625,8 +625,8 @@
<hibernate_validator_version>5.4.2.Final</hibernate_validator_version>
<httpcore_version>4.4.11</httpcore_version>
<httpclient_version>4.5.9</httpclient_version>
<jackson_version>2.9.9</jackson_version>
<jackson_databind_version>2.9.10</jackson_databind_version>
<jackson_version>2.10.0</jackson_version>
<jackson_databind_version>2.10.0</jackson_databind_version>
<maven_assembly_plugin_version>3.1.0</maven_assembly_plugin_version>
<maven_license_plugin_version>1.8</maven_license_plugin_version>
<resteasy_version>4.0.0.Beta3</resteasy_version>

View File

@ -79,6 +79,13 @@
stored in the RDBMS.
]]>
</action>
<action type="fix">
<![CDATA[
<b>New Feature</b>:
The R4 structures have been upgraded to the new 4.0.1 (Technical Correction) release, and the
R5 structure have been upgraded to the current (October) snapshot.
]]>
</action>
<action type="add" issue="1489">
<![CDATA[
<b>Performance Improvement</b>: