Class ThreadAwareContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAsserts aCompletionListeneris not calling from its ownConnectionor from aMessageProducer.voidAsserts aCompletionListeneris not calling from its ownJMSContext.voidAsserts aMessageListeneris not calling from its ownConnectionorMessageConsumer.voidAsserts aMessageListeneris not calling from its ownJMSContext.voidclearCurrentThread(boolean isCompletionListener) Clear current thread from the contextvoidsetCurrentThread(boolean isCompletionListener) Sets current thread to the context
-
Constructor Details
-
ThreadAwareContext
public ThreadAwareContext()
-
-
Method Details
-
setCurrentThread
public void setCurrentThread(boolean isCompletionListener) Sets current thread to the contextMeant 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.
-
assertNotCompletionListenerThreadRuntime
public void assertNotCompletionListenerThreadRuntime()Asserts aCompletionListeneris not calling from its ownJMSContext.Note that the code must work without any need for further synchronization, as there is the requirement that only one CompletionListener be called at a time. In other words, CompletionListener calling is single-threaded.
- See Also:
-
JMSContext.close()JMSContext.stop()JMSContext.commit()JMSContext.rollback()
-
assertNotCompletionListenerThread
public void assertNotCompletionListenerThread() throws jakarta.jms.IllegalStateExceptionAsserts aCompletionListeneris not calling from its ownConnectionor from aMessageProducer.Note that the code must work without any need for further synchronization, as there is the requirement that only one CompletionListener be called at a time. In other words, CompletionListener calling is single-threaded.
- Throws:
jakarta.jms.IllegalStateException- See Also:
-
Connection.close()MessageProducer.close()
-
assertNotMessageListenerThreadRuntime
public void assertNotMessageListenerThreadRuntime()Asserts aMessageListeneris not calling from its ownJMSContext.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()
-
assertNotMessageListenerThread
public void assertNotMessageListenerThread() throws jakarta.jms.IllegalStateExceptionAsserts aMessageListeneris not calling from its ownConnectionorMessageConsumer.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.
- Throws:
jakarta.jms.IllegalStateException- See Also:
-
Connection.close()MessageConsumer.close()
-