SingleConnectionFactory - 引发ConcurrentModificationException

时间:2015-04-10 19:44:06

标签: spring spring-jms

我使用多个SimpleMessageListenerContainers,它们都使用SingleConnectionFactory中的SAME连接。它们都在SingleConnectionFactory的AggregatedExceptionListener中注册。因为,当SingleConnectionFactory的JMS连接断开连接时,需要通知所有SMLC以清除其会话和消费者,并从SCF获取新连接。

但是,当SingleConnectionFactory的AggregatedExceptionListener迭代其“this.delegates”并尝试调用“listener.onException()”(例如,我的所有SMLC都是委托)时,会发生此错误。

这似乎是Spring类中的一个错误。它应该是,创建委托的副本然后迭代复制的列表,因此如果列表被修改,它不会引发ConcurrentModificationException。

对工作的任何想法都表示赞赏。

13:30:28,201 ERROR [SimpleMessageListenerContainer] Encountered non-recoverable JMSException
javax.jms.JMSException: java.io.EOFException
    at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:54)
    at org.apache.activemq.ActiveMQConnection.onAsyncException(ActiveMQConnection.java:1998)
    at org.apache.activemq.ActiveMQConnection.onException(ActiveMQConnection.java:2017)
    at org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:101)
    at org.apache.activemq.transport.ResponseCorrelator.onException(ResponseCorrelator.java:126)
    at org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:101)
    at org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:101)
    at org.apache.activemq.transport.WireFormatNegotiator.onException(WireFormatNegotiator.java:160)
    at org.apache.activemq.transport.AbstractInactivityMonitor.onException(AbstractInactivityMonitor.java:314)
    at org.apache.activemq.transport.TransportSupport.onException(TransportSupport.java:96)
    at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:200)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
    at java.io.DataInputStream.readInt(Unknown Source)
    at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:258)
    at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:221)
    at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:213)
    at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)
    ... 1 more
Exception in thread "ActiveMQ Connection Executor: tcp://localhost/127.0.0.1:9002@58017" java.util.ConcurrentModificationException
    at java.util.LinkedHashMap$LinkedHashIterator.nextNode(Unknown Source)
    at java.util.LinkedHashMap$LinkedKeyIterator.next(Unknown Source)
    at org.springframework.jms.connection.SingleConnectionFactory$AggregatedExceptionListener.onException(SingleConnectionFactory.java:670)
    at org.apache.activemq.ActiveMQConnection$5.run(ActiveMQConnection.java:2005)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

1 个答案:

答案 0 :(得分:0)

这是您怀疑的错误,请参阅https://jira.spring.io/browse/SPR-13421

应该在即将于2015年10月15日发布的4.1.8和4.2.2版中修复。