Class ThreadAwareContext


  • public class ThreadAwareContext
    extends Object
    Restricts what can be called on context passed in wrapped CompletionListener.
    • Constructor Detail

      • ThreadAwareContext

        public ThreadAwareContext()
    • Method Detail

      • setCurrentThread

        public void setCurrentThread​(boolean isCompletionListener)
        Sets current thread to the context

        Meant to inform an JMSContext which is the thread that CANNOT call some of its methods.

        Parameters:
        isCompletionListener - : indicating whether current thread is from CompletionListener or from MessageListener.
      • clearCurrentThread

        public void clearCurrentThread​(boolean isCompletionListener)
        Clear current thread from the context
        Parameters:
        isCompletionListener - : indicating whether current thread is from CompletionListener or from MessageListener.
      • assertNotMessageListenerThreadRuntime

        public void assertNotMessageListenerThreadRuntime()
        Asserts a MessageListener is not calling from its own JMSContext.

        Note that the code must work without any need for further synchronization, as there is the requirement that only one MessageListener be called at a time. In other words, MessageListener calling is single-threaded.

        See Also:
        JMSContext.close(), JMSContext.stop()