just clearing the cache doesn't shut down the channel consumers. Switching to unregisterAll

This commit is contained in:
Ken Stevens 2019-02-02 19:26:20 -05:00
parent 84db66d2e3
commit 4a49a9362e
3 changed files with 2 additions and 14 deletions

View File

@ -20,7 +20,6 @@ package ca.uhn.fhir.jpa.subscription.module.cache;
* #L% * #L%
*/ */
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import java.util.ArrayList; import java.util.ArrayList;
@ -70,9 +69,4 @@ class ActiveSubscriptionCache {
} }
} }
} }
@VisibleForTesting
void clearForUnitTests() {
myCache.clear();
}
} }

View File

@ -24,7 +24,6 @@ import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.model.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.jpa.model.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.jpa.model.interceptor.api.Pointcut; import ca.uhn.fhir.jpa.model.interceptor.api.Pointcut;
import ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription; import ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription;
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
@ -113,7 +112,7 @@ public class SubscriptionRegistry {
} }
@PreDestroy @PreDestroy
public void preDestroy() { public void unregisterAllSubscriptions() {
unregisterAllSubscriptionsNotInCollection(Collections.emptyList()); unregisterAllSubscriptionsNotInCollection(Collections.emptyList());
} }
@ -156,9 +155,4 @@ public class SubscriptionRegistry {
public int size() { public int size() {
return myActiveSubscriptionCache.size(); return myActiveSubscriptionCache.size();
} }
@VisibleForTesting
public void clearForUnitTests() {
myActiveSubscriptionCache.clearForUnitTests();
}
} }

View File

@ -73,7 +73,7 @@ public abstract class BaseBlockingQueueSubscribableChannelDstu3Test extends Base
ourCreatedObservations.clear(); ourCreatedObservations.clear();
ourUpdatedObservations.clear(); ourUpdatedObservations.clear();
ourContentTypes.clear(); ourContentTypes.clear();
mySubscriptionRegistry.clearForUnitTests(); mySubscriptionRegistry.unregisterAllSubscriptions();
if (ourSubscribableChannel == null) { if (ourSubscribableChannel == null) {
ourSubscribableChannel = mySubscriptionChannelFactory.newDeliveryChannel("test", Subscription.SubscriptionChannelType.RESTHOOK.toCode().toLowerCase()); ourSubscribableChannel = mySubscriptionChannelFactory.newDeliveryChannel("test", Subscription.SubscriptionChannelType.RESTHOOK.toCode().toLowerCase());
ourSubscribableChannel.subscribe(myStandaloneSubscriptionMessageHandler); ourSubscribableChannel.subscribe(myStandaloneSubscriptionMessageHandler);