diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSContext.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSContext.java index 7a6c9ef0e0..ae3ab5d75e 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSContext.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSContext.java @@ -58,7 +58,7 @@ public class ActiveMQJMSContext implements JMSContext { private volatile Message lastMessagesWaitingAck; private final ActiveMQConnectionForContext connection; - private Session session; + private volatile Session session; private boolean autoStart = ActiveMQJMSContext.DEFAULT_AUTO_START; private MessageProducer innerProducer; private boolean xa; @@ -91,6 +91,7 @@ public class ActiveMQJMSContext implements JMSContext { } public Session getSession() { + checkSession(); return session; }