Loop over new list to avoid ConcurrentModificationException in case a new hook is added while looping
@@ -291,7 +291,8 @@ public abstract class BaseInterceptorService<POINTCUT extends IPointcut> impleme
}
private Object doCallHooks(POINTCUT thePointcut, HookParams theParams, Object theRetVal) {
- List<BaseInvoker> invokers = getInvokersForPointcut(thePointcut);
+ // use new list for loop to avoid ConcurrentModificationException in case invoker gets added while looping
+ List<BaseInvoker> invokers = new ArrayList<>(getInvokersForPointcut(thePointcut));
/*
* Call each hook in order
