I have refactored several parts of the JMS Transport to make it easier to understand and to help preparing for a move to the spring jms classes.
The refactoring should not change the functionality.
SessionFactory and PooledSession:
The sessionfactory had two different caches and a lot of redundant code. I have now only one cache left that starts send only. A consumer is then added when the first client needs it. The lines of code of SessionFactory are reduced from 450 to 300.
Functionality of JMSProviderHub is splitted between SessionFactory and JMSUtils
The connect method now does not need a callback anymore. So the interface JMSOnConnectCallback is deleted.
Extracted the class from JMSDestination and JMSConduit. They both use the same JMSOutputStream now. A new interface JMSExchangeSender calls back into JMSConduit or JMSDestination.
JMSListenerThread and JMSExecutor:
Extracted JMSListenerThread from JMSDestination. So the complete JMS listen functionality is factored out. This means it will be easier to port to Spring MessageListenerContainer. JMSListener does not use the Session pool anymore as it does not need pooling anyway.
Made the program flow easier again and documented where the flow of operation is not easy to understand. 420 lines => 290 lines
Same as with JMSConduit. 550 lines => 420 lines
All tests work
- Cut most of PooledSessionTest as it does not apply anymore. Have not written a new test yet. But I think it is mostly implicitly tested by other tests
- AbstractJMSTests replaced setInMessage with setOutMessage. I think this was wrong before. Please review
- JMSDestinationTest added a second message send as I had an issue with a closed session after first send because of an error in the SessionFactory. This is to avoid regression