storm-jms
storm-jms copied to clipboard
JMS Session instance should not be used from multiple threads
In JmsSpout.java javax.jms.Session
instance is used by multiple threads what is errornous according to Javadoc:
Once a connection has been started, any session with one or more registered message listeners is dedicated to the thread of control that delivers messages to it. It is erroneous for client code to use this session or any of its constituent objects from another thread of control. The only exception to this rule is the use of the session or message consumer close method.
The close method is the only session method that can be called while some other session method is being executed in another thread.
In JmsSpout.java message listener is registered (line 179), so the Session
instance is dedicated to the thread delivering messages. At the same time scheduled executor periodically runs RecoveryTask
calling recover()
method on the same Session
instance in new thread (line 356).
According to Javadoc this is erroneous usage of Session
.