steingebein commented on a change in pull request #603: [CXF-8161] fix memory 
leak and thread leak in JMSDestination
URL: https://github.com/apache/cxf/pull/603#discussion_r349066098
 
 

 ##########
 File path: 
rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
 ##########
 @@ -174,9 +174,9 @@ public void onException(JMSException exception) {
         }
     }
 
-    protected void restartConnection() {
+    protected synchronized void restartConnection() {
 
 Review comment:
   I don't think we're getting a deadlock. The first thread calling 
`restartConnection()` (`unnamed` or poller-thread) will do the restart - other 
threads will wait/block until `restartConnection()` is finished. The 
`ExceptionListener` is only called from the poller threads, these will wait 
until `restartConnection()` is finished.
   So all threads get blocked until the restart ist successful. Without a 
connection the threads cann't do anything useful - I think this is ok when they 
are blocked.
   
   One Problem can occur: when `restartConnection()` runs in 
`createTargetDestinationListener()` to  `container.start()` another 
`ThreadPool` will be created and the threads are blocked - every time until 
restart is successful. 
   I have no idea how to solve this problem, but I think it's not critical 
because at this point we already have a successful JMS connection. 
   
   BTW:
   When you use the flag  jmsConfig.isOneSessionPerConnection = true, the 
Exception Handling will not work. The `ExceptionHander `is alwas null and 
`PollingMessageListenerContainer#handleException()` run into a 
NullPointerException, so I ignored this case.
   
   I think the interaction between `JMSDestination`, 
`PollingMessageListenerContainer` and the poller-threads is very complicated 
and fragile. I think for future versions there must be a rewrite of the code.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to