/** * This is called by client proxies. Calling a method on a client proxy means that we left the interception context of the calling bean. Therefore, * client proxies call this method to start a new interception context of the called (possibly intercepted) bean. If however there is not interception context * at the time the proxy is called (meaning the caller is not intercepted), there is no need to create new interception context. This is an optimization as the * first startInterceptorContext call is expensive. * * If this method returns a non-null value, the caller of this method is required to call {@link Stack#end()} on the returned value. */ public static Stack startIfNotEmpty() { Stack stack = getStack(); if (!stack.elements.isEmpty()) { stack.push(CombinedInterceptorAndDecoratorStackMethodHandler.NULL_INSTANCE); return stack; } else { // if RequestScopedCache is not active, remove now to prevent ThreadLocal leak stack.removeIfEmpty(); return null; } }
/** * This is called by client proxies. Calling a method on a client proxy means that we left the interception context of the calling bean. Therefore, * client proxies call this method to start a new interception context of the called (possibly intercepted) bean. If however there is not interception context * at the time the proxy is called (meaning the caller is not intercepted), there is no need to create new interception context. This is an optimization as the * first startInterceptorContext call is expensive. * * If this method returns a non-null value, the caller of this method is required to call {@link Stack#end()} on the returned value. */ public static Stack startIfNotEmpty() { Stack stack = getStack(); if (!stack.elements.isEmpty()) { stack.push(CombinedInterceptorAndDecoratorStackMethodHandler.NULL_INSTANCE); return stack; } else { // if RequestScopedCache is not active, remove now to prevent ThreadLocal leak stack.removeIfEmpty(); return null; } }
/** * This is called by client proxies. Calling a method on a client proxy means that we left the interception context of the calling bean. Therefore, * client proxies call this method to start a new interception context of the called (possibly intercepted) bean. If however there is not interception context * at the time the proxy is called (meaning the caller is not intercepted), there is no need to create new interception context. This is an optimization as the * first startInterceptorContext call is expensive. * * If this method returns a non-null value, the caller of this method is required to call {@link Stack#end()} on the returned value. */ public static Stack startIfNotEmpty() { Stack stack = getStack(); if (!stack.elements.isEmpty()) { stack.push(CombinedInterceptorAndDecoratorStackMethodHandler.NULL_INSTANCE); return stack; } else { // if RequestScopedCache is not active, remove now to prevent ThreadLocal leak stack.removeIfEmpty(); return null; } }
/** * This is called by client proxies. Calling a method on a client proxy means that we left the interception context of the calling bean. Therefore, * client proxies call this method to start a new interception context of the called (possibly intercepted) bean. If however there is not interception context * at the time the proxy is called (meaning the caller is not intercepted), there is no need to create new interception context. This is an optimization as the * first startInterceptorContext call is expensive. * * If this method returns a non-null value, the caller of this method is required to call {@link Stack#end()} on the returned value. */ public static Stack startIfNotEmpty() { Stack stack = getStack(); if (!stack.elements.isEmpty()) { stack.push(CombinedInterceptorAndDecoratorStackMethodHandler.NULL_INSTANCE); return stack; } else { // if RequestScopedCache is not active, remove now to prevent ThreadLocal leak stack.removeIfEmpty(); return null; } }
/** * Pushes the given context to the stack if the given context is not on top of the stack already. * If this method return a non-null value, the caller is responsible for calling {@link #endInterceptorContext()} * after the invocation finishes. * @param context the given context * @return true if the given context was pushed to the top of the stack, false if the given context was on top already */ public static Stack startIfNotOnTop(CombinedInterceptorAndDecoratorStackMethodHandler context) { Stack stack = getStack(); if (stack.startIfNotOnTop(context)) { return stack; } return null; }
@Override public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { return invoke(InterceptionDecorationContext.getStack(), self, thisMethod, proceed, args); }
@Override public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { return invoke(InterceptionDecorationContext.getStack(), self, thisMethod, proceed, args); }
@Override public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { return invoke(InterceptionDecorationContext.getStack(), self, thisMethod, proceed, args); }
@Override public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { return invoke(InterceptionDecorationContext.getStack(), self, thisMethod, proceed, args); }
/** * Pushes the given context to the stack if the given context is not on top of the stack already. * If this method return a non-null value, the caller is responsible for calling {@link #endInterceptorContext()} * after the invocation finishes. * @param context the given context * @return true if the given context was pushed to the top of the stack, false if the given context was on top already */ public static Stack startIfNotOnTop(CombinedInterceptorAndDecoratorStackMethodHandler context) { Stack stack = getStack(); if (stack.startIfNotOnTop(context)) { return stack; } return null; }
@Override public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { return invoke(InterceptionDecorationContext.getStack(), self, thisMethod, proceed, args); }
/** * Pushes the given context to the stack if the given context is not on top of the stack already. * If this method return a non-null value, the caller is responsible for calling {@link #endInterceptorContext()} * after the invocation finishes. * @param context the given context * @return true if the given context was pushed to the top of the stack, false if the given context was on top already */ public static Stack startIfNotOnTop(CombinedInterceptorAndDecoratorStackMethodHandler context) { Stack stack = getStack(); if (stack.startIfNotOnTop(context)) { return stack; } return null; }
@Override public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { return invoke(InterceptionDecorationContext.getStack(), self, thisMethod, proceed, args); }
/** * Pushes the given context to the stack if the given context is not on top of the stack already. * If this method return a non-null value, the caller is responsible for calling {@link #endInterceptorContext()} * after the invocation finishes. * @param context the given context * @return true if the given context was pushed to the top of the stack, false if the given context was on top already */ public static Stack startIfNotOnTop(CombinedInterceptorAndDecoratorStackMethodHandler context) { Stack stack = getStack(); if (stack.startIfNotOnTop(context)) { return stack; } return null; }
/** * Pushes the given context to the stack if the given context is not on top of the stack already. * If this method return a non-null value, the caller is responsible for calling {@link #endInterceptorContext()} * after the invocation finishes. * @param context the given context * @return true if the given context was pushed to the top of the stack, false if the given context was on top already */ public static Stack startIfNotOnTop(CombinedInterceptorAndDecoratorStackMethodHandler context) { Stack stack = getStack(); if (stack.startIfNotOnTop(context)) { return stack; } return null; }
/** * Pushes the given context to the stack if the given context is not on top of the stack already. * If this method return a non-null value, the caller is responsible for calling {@link #endInterceptorContext()} * after the invocation finishes. * @param context the given context * @return true if the given context was pushed to the top of the stack, false if the given context was on top already */ public static Stack startIfNotOnTop(CombinedInterceptorAndDecoratorStackMethodHandler context) { Stack stack = getStack(); if (stack.startIfNotOnTop(context)) { return stack; } return null; }
@Override public Object invoke(Stack stack, Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { if (stack == null) { /* * This is a lifecycle callback invocation. * 1) Lifecycle callback interception is never suppressed by IDC * 2) Interception of methods called by lifecycle callbacks is suppressed */ stack = InterceptionDecorationContext.getStack(); return invoke(stack, self, thisMethod, proceed, args, true, stack.startIfNotOnTop(this)); } else { /* * This is an around-invoke interception * Interceptors are invoked as long as the current IDC is not suppressed. */ boolean intercept = stack.startIfNotOnTop(this); return invoke(stack, self, thisMethod, proceed, args, intercept, intercept); } }
@Override public Object invoke(Stack stack, Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { if (stack == null) { /* * This is a lifecycle callback invocation. * 1) Lifecycle callback interception is never suppressed by IDC * 2) Interception of methods called by lifecycle callbacks is suppressed */ stack = InterceptionDecorationContext.getStack(); return invoke(stack, self, thisMethod, proceed, args, true, stack.startIfNotOnTop(this)); } else { /* * This is an around-invoke interception * Interceptors are invoked as long as the current IDC is not suppressed. */ boolean intercept = stack.startIfNotOnTop(this); return invoke(stack, self, thisMethod, proceed, args, intercept, intercept); } }
@Override public Object invoke(Stack stack, Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { if (stack == null) { /* * This is a lifecycle callback invocation. * 1) Lifecycle callback interception is never suppressed by IDC * 2) Interception of methods called by lifecycle callbacks is suppressed */ stack = InterceptionDecorationContext.getStack(); return invoke(stack, self, thisMethod, proceed, args, true, stack.startIfNotOnTop(this)); } else { /* * This is an around-invoke interception * Interceptors are invoked as long as the current IDC is not suppressed. */ boolean intercept = stack.startIfNotOnTop(this); return invoke(stack, self, thisMethod, proceed, args, intercept, intercept); } }
@Override public Object invoke(Stack stack, Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { if (stack == null) { /* * This is a lifecycle callback invocation. * 1) Lifecycle callback interception is never suppressed by IDC * 2) Interception of methods called by lifecycle callbacks is suppressed */ stack = InterceptionDecorationContext.getStack(); return invoke(stack, self, thisMethod, proceed, args, true, stack.startIfNotOnTop(this)); } else { /* * This is an around-invoke interception * Interceptors are invoked as long as the current IDC is not suppressed. */ boolean intercept = stack.startIfNotOnTop(this); return invoke(stack, self, thisMethod, proceed, args, intercept, intercept); } }