Class InterceptionDecorationContext


  • public class InterceptionDecorationContext
    extends Object
    A class that holds the interception (and decoration) contexts which are currently in progress.

    An interception context is a set of CombinedInterceptorAndDecoratorStackMethodHandler references for which interception is currently suppressed (so that self-invocation is not possible). Such references are added as soon as a CombinedMethodHandler is executed in an interception context that does not hold it.

    Classes may create new interception contexts as necessary (e.g. allowing client proxies to create new interception contexts in order to make circular references interceptable multiple times).

    Author:
    Marius Bogoevici
    • Method Detail

      • peekIfNotEmpty

        public static CombinedInterceptorAndDecoratorStackMethodHandler peekIfNotEmpty()
        Peeks the current top of the stack or returns null if the stack is empty
        Returns:
        the current top of the stack or returns null if the stack is empty
      • empty

        public static boolean empty()
        Indicates whether the stack is empty.
      • endInterceptorContext

        public static void endInterceptorContext()
      • startIfNotEmpty

        public static InterceptionDecorationContext.Stack startIfNotEmpty()
        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 InterceptionDecorationContext.Stack.end() on the returned value.