PointCutLatch now works with IPointcut instead of Pointcut

This commit is contained in:
Diederik Muylwyk 2021-03-29 18:20:33 -04:00
parent 953dd408da
commit bddd3f4c92
3 changed files with 10 additions and 5 deletions

View File

@ -31,6 +31,6 @@ import com.google.common.annotations.VisibleForTesting;
@VisibleForTesting @VisibleForTesting
public interface IAnonymousInterceptor { public interface IAnonymousInterceptor {
void invoke(Pointcut thePointcut, HookParams theArgs); void invoke(IPointcut thePointcut, HookParams theArgs);
} }

View File

@ -0,0 +1,4 @@
---
type: change
issue: 2513
title: "PointCutLatch now works with IPointcut instead of Pointcut."

View File

@ -23,7 +23,7 @@ package ca.uhn.test.concurrency;
import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor;
import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.api.IPointcut;
import com.google.common.collect.ListMultimap; import com.google.common.collect.ListMultimap;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
@ -52,11 +52,12 @@ public class PointcutLatch implements IAnonymousInterceptor, IPointcutLatch {
private final AtomicReference<String> myCountdownLatchSetStacktrace = new AtomicReference<>(); private final AtomicReference<String> myCountdownLatchSetStacktrace = new AtomicReference<>();
private final AtomicReference<List<String>> myFailures = new AtomicReference<>(); private final AtomicReference<List<String>> myFailures = new AtomicReference<>();
private final AtomicReference<List<HookParams>> myCalledWith = new AtomicReference<>(); private final AtomicReference<List<HookParams>> myCalledWith = new AtomicReference<>();
private final Pointcut myPointcut; private final IPointcut myPointcut;
private int myDefaultTimeoutSeconds = DEFAULT_TIMEOUT_SECONDS; private int myDefaultTimeoutSeconds = DEFAULT_TIMEOUT_SECONDS;
private int myInitialCount; private int myInitialCount;
private boolean myExactMatch; private boolean myExactMatch;
public PointcutLatch(Pointcut thePointcut) {
public PointcutLatch(IPointcut thePointcut) {
this.myName = thePointcut.name(); this.myName = thePointcut.name();
myPointcut = thePointcut; myPointcut = thePointcut;
} }
@ -189,7 +190,7 @@ public class PointcutLatch implements IAnonymousInterceptor, IPointcutLatch {
@Override @Override
public void invoke(Pointcut thePointcut, HookParams theArgs) { public void invoke(IPointcut thePointcut, HookParams theArgs) {
myLastInvoke.set(System.currentTimeMillis()); myLastInvoke.set(System.currentTimeMillis());
CountDownLatch latch = myCountdownLatch.get(); CountDownLatch latch = myCountdownLatch.get();