Hi,

I'm using CXF 3.4.0 in a Spring 5.2 application with an ActiveMQ middle ware.
On application shutdown I see 2 warnings. Looking at the 
PollingMessageListenerContainer code I noticed that when the consumer/session 
is closed (and thus a null message is returned from consumer.receive) the next 
step (session.getTransacted) fails and produces the result below.
Why is the session.getTransacted not within the message != null branch?

Regards
Bjorn

org.apache.cxf.transport.jms.util.PollingMessageListenerContainer$Poller:line 
80-92;

>> NOTE: the running boolean is not sync'ed nor volatile yet used by multiple 
>> threads!
while (running) {
                Message message = consumer.receive(1000);
                try {
                               if (message != null) {
                                               
listenerHandler.onMessage(message);
                               }
>> should the next test not be within the if branch above and so fix the 
>> shutdown warnings? When a consumer is closed it returns a null message. Also 
>> when a receive timeout occurs (message also null) these is no reason to 
>> commit.
                               if (session.getTransacted()) {      << this 
fails when consumer/session is closed on ActiveMQ
                                               session.commit();
                               }
                } catch (Throwable e) {
                               LOG.log(Level.WARNING, "Exception while 
processing jms message in cxf. Rolling back", e);
                               safeRollBack(session);
                }
}

[2020-01-14 11:21:19,962 WARN ] [myTaskExecutor -2] 
[PollingMessageListenerContainer$Poller:90] 
[org.apache.cxf.transport.jms.util.PollingMessageListenerContainer] Exception 
while processing jms message in cxf. Rolling back
javax.jms.IllegalStateException: The Session is closed
        at 
org.apache.activemq.ActiveMQSession.checkClosed(ActiveMQSession.java:771)
        at 
org.apache.activemq.ActiveMQSession.getTransacted(ActiveMQSession.java:540)
        at 
org.apache.cxf.transport.jms.util.PollingMessageListenerContainer$Poller.run(PollingMessageListenerContainer.java:86)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
[2020-01-14 11:21:19,963 WARN ] [myTaskExecutor-2] 
[PollingMessageListenerContainer$Poller:111] 
[org.apache.cxf.transport.jms.util.PollingMessageListenerContainer] Rollback of 
Local transaction failed
javax.jms.IllegalStateException: The Session is closed
        at 
org.apache.activemq.ActiveMQSession.checkClosed(ActiveMQSession.java:771)
        at 
org.apache.activemq.ActiveMQSession.getTransacted(ActiveMQSession.java:540)
        at 
org.apache.cxf.transport.jms.util.PollingMessageListenerContainer$Poller.safeRollBack(PollingMessageListenerContainer.java:107)
        at 
org.apache.cxf.transport.jms.util.PollingMessageListenerContainer$Poller.run(PollingMessageListenerContainer.java:91)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)



De informatie in dit e-mailbericht is vertrouwelijk en uitsluitend bestemd voor 
de 
geadresseerde. Wanneer u dit bericht per abuis ontvangt, verzoeken wij u 
contact op te 
nemen met de afzender per kerende e-mail. Verder verzoeken wij u in dat geval 
dit 
e-mailbericht te vernietigen en de inhoud ervan aan niemand openbaar te maken. 
Wij aanvaarden geen aansprakelijkheid voor onjuiste, onvolledige dan wel 
ontijdige 
overbrenging van de inhoud van een verzonden e-mailbericht, noch voor daarbij 
overgebrachte virussen.

APG Groep N.V. is gevestigd te Heerlen en is ingeschreven in het 
handelsregister van de Kamer van Koophandel Limburg onder nummer 14099617


The information contained in this e-mail is confidential and may be privileged. 
It may be read, copied and used only by the intended recipient. 
If you have received it in error, please contact the sender immediately by 
return e-mail; please delete in this case the e-mail and do not disclose its 
contents to any person. We don't accept liability for any errors, omissions, 
delays of receipt or viruses in the contents of this message which arise as a 
result of e-mail transmission.

APG Groep N.V. is registered in the trade register of the Chamber 
of Commerce Limburg, The Netherlands, registration number: 14099617

Reply via email to