Interface Contextualizer

  • All Known Implementing Classes:
    ContextualizerImpl

    public interface Contextualizer
    Wraps an object with a proxy that sets Payara context around every method call. This is useful for listeners, callbacks, and other objects that run from another thread that may not have Payara context initialized. This was create primarily to facilitate integration with Hazelcast, which has listeners that do not capture Payara context. Example:
    Author:
    lprimak
    • Method Detail

      • contextualize

        <T> T contextualize​(T object,
                            Class<T> intf)
        Wraps an object in a proxy that preserves Payara context
        Type Parameters:
        T - object type to proxy and contextualize
        Parameters:
        object - object instance to proxy and contextualize
        intf - Interface that is used to proxy the object
        Returns:
        proxied object
      • contextualize

        <T> T contextualize​(T object,
                            ContextProducer.Instance context,
                            Class<T> intf)
        Wraps an object in a proxy that preserves Payara context
        Type Parameters:
        T -
        Parameters:
        object -
        context -
        intf -
        Returns:
        proxied object
      • contextualize

        <T> T contextualize​(T object,
                            ContextProducer.Instance context,
                            Stream<Class<?>> interfaces)
        Wraps an object in a proxy that preserves Payara context
        Type Parameters:
        T -
        Parameters:
        object -
        context -
        interfaces -
        Returns:
        proxied object