reta 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_r348876576
##########
File path:
rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/PollingMessageListenerContainer.java
##########
@@ -210,6 +210,8 @@ protected void handleException(Throwable e) {
wrapped.addSuppressed(e);
}
this.exceptionListener.onException(wrapped);
+ // stop the executor and the current thread after handling of the
exception.
Review comment:
If I understood the idea behind current implementation correctly, we have
the problem with `running` flag. The first thing `restartConnection` does is to
deactivate the existing `jmsListener` by calling shutdown. Unfortunately,
method short-circuits because the `running` flag is unset, the executor is not
being shut down properly. We could fix it by introducing `shutdown` flag or
just calling `super.stop();`:
```
@Override
public void stop() {
LOG.fine("Shuttting down " + this.getClass().getSimpleName());
if (!running) {
super.stop();
return;
}
running = false;
super.stop();
}
```
Wdyt?
----------------------------------------------------------------
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