Class ContainerHelper


  • public class ContainerHelper
    extends Object
    Helper methods for Container aware logic.
    Since:
    Coherence 12.2.1
    Author:
    gg 2005.10.24
    • Constructor Detail

      • ContainerHelper

        public ContainerHelper()
    • Method Detail

      • initializeThreadContext

        public static void initializeThreadContext​(Service service)
        Initialize the thread context for the given Service.
        Parameters:
        service - a Service instance
      • getSwitchCurrentContext

        public static ContainerContext getSwitchCurrentContext​(Service service)
        Given the ContainerContext associated with the specified Service and the current thread's context, return a ContainerContext instance that should be used by the Service thread to perform actions on behalf of the current thread's context.
        Parameters:
        service - a Service instance
        Returns:
        a ContainerContext to use for invocations later or null if the invocation should be done using the service thread context
      • getSwitchServiceContext

        public static ContainerContext getSwitchServiceContext​(Service service)
        Given the ContainerContext associated with the specified Service and the current thread's context, return a ContainerContext instance that should be used by the current thread to perform actions on behalf of the Service thread's context.
        Parameters:
        service - a Service instance
        Returns:
        a ContainerContext to use for invocations later or null if the invocation should be done using the current thread context
      • getContextAwareListener

        public static MapListener getContextAwareListener​(Service service,
                                                          MapListener listener)
        Wrap the specified MapListener in such a way that the returned listener would dispatch events using the caller's context rather than context associated with the specified Service.
        Parameters:
        service - a Service instance
        listener - the listener to wrap
        Returns:
        the corresponding context aware listener