Skip to content

Commit

Permalink
just clearing the cache doesn't shut down the channel consumers. Swit…
Browse files Browse the repository at this point in the history
…ching to unregisterAll
  • Loading branch information
fil512 committed Feb 3, 2019
1 parent 84db66d commit 4a49a93
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
Expand Up @@ -20,7 +20,6 @@
* #L%
*/

import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.Validate;

import java.util.ArrayList;
Expand Down Expand Up @@ -70,9 +69,4 @@ public void unregisterAllSubscriptionsNotInCollection(Collection<String> theAllI
}
}
}

@VisibleForTesting
void clearForUnitTests() {
myCache.clear();
}
}
Expand Up @@ -24,7 +24,6 @@
import ca.uhn.fhir.jpa.model.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.jpa.model.interceptor.api.Pointcut;
import ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription;
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
Expand Down Expand Up @@ -113,7 +112,7 @@ public void unregisterSubscription(IIdType theId) {
}

@PreDestroy
public void preDestroy() {
public void unregisterAllSubscriptions() {
unregisterAllSubscriptionsNotInCollection(Collections.emptyList());
}

Expand Down Expand Up @@ -156,9 +155,4 @@ public boolean unregisterSubscriptionIfRegistered(IBaseResource theSubscription,
public int size() {
return myActiveSubscriptionCache.size();
}

@VisibleForTesting
public void clearForUnitTests() {
myActiveSubscriptionCache.clearForUnitTests();
}
}
Expand Up @@ -73,7 +73,7 @@ public void beforeReset() {
ourCreatedObservations.clear();
ourUpdatedObservations.clear();
ourContentTypes.clear();
mySubscriptionRegistry.clearForUnitTests();
mySubscriptionRegistry.unregisterAllSubscriptions();
if (ourSubscribableChannel == null) {
ourSubscribableChannel = mySubscriptionChannelFactory.newDeliveryChannel("test", Subscription.SubscriptionChannelType.RESTHOOK.toCode().toLowerCase());
ourSubscribableChannel.subscribe(myStandaloneSubscriptionMessageHandler);
Expand Down

0 comments on commit 4a49a93

Please sign in to comment.