ActiveMQ阻塞问题

J2EE 码拜 9年前 (2015-04-13) 2447次浏览 0个评论

使用ActiveMQ,为了测试拔掉了网线,就出来如下异常
– Transport Connection to: tcp://211.69.207.52:11334 failed: java.net.SocketException: Connection reset
– Transport Connection to: tcp://211.69.207.52:11335 failed: java.net.SocketException: Connection reset
– Transport Connection to: tcp://211.69.207.52:11333 failed: java.net.SocketException: Connection reset
– Transport (tcp://211.69.207.52:61616) failed, reason:  java.net.SocketException: Connection reset, attempting to automatically reconnect
– Transport (tcp://211.69.207.52:61616) failed, reason:  java.net.SocketException: Connection reset, attempting to automatically reconnect
– Transport (tcp://211.69.207.52:61616) failed, reason:  java.net.SocketException: Connection reset, attempting to automatically reconnect

此后程序就堵塞在producer.send(msg); 这里
当连上网线后,提示
– Successfully reconnected to tcp://211.69.207.52:61616
– Successfully reconnected to tcp://211.69.207.52:61616

此后程序才能继续跑下去

想让能在网线拔掉的状态下,生产者能继续发消息 不知道这个异常是怎么产生的

ActiveMQ阻塞问题
不知道是不是我的配置有问题?
启动时的输出是这样:
Msg Broker url=tcp://211.69.207.52:61616
– JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
– PListStore:[D:\Java Workspace\OSGiConfig\activemq-data\localhost\tmp_storage] started
– Using Persistence Adapter: KahaDBPersistenceAdapter[D:\Java Workspace\OSGiConfig\activemq-data\localhost\KahaDB]
– KahaDB is version 4
– Recovering from the journal …
– Recovery replayed 5 operations from the journal in 0.0 seconds.
– Apache ActiveMQ 5.7.0 (localhost, ID:penguin-4482-1409623892703-0:1) is starting
– Listening for connections at: tcp://penguin:61616
– Connector tcp://penguin:61616 Started
– Apache ActiveMQ 5.7.0 (localhost, ID:penguin-4482-1409623892703-0:1) started
– For help or more information please see: http://activemq.apache.org
– Store limit is 102400 mb, whilst the data directory: D:\Java Workspace\OSGiConfig\activemq-data\localhost\KahaDB only has 34421 mb of usable space
– Temporary Store limit is 51200 mb, whilst the temporary data directory: D:\Java Workspace\OSGiConfig\activemq-data\localhost\tmp_storage only has 34421 mb of usable space
Message broker started ….

– Successfully connected to tcp://211.69.207.52:61616
– Successfully connected to tcp://211.69.207.52:61616
– Successfully connected to tcp://211.69.207.52:61616

ActiveMQ阻塞问题
40分
你应该设置持久化订阅了吧。有没有这句设置setDeliveryMode(DeliveryMode.PERSISTENT);
ActiveMQ阻塞问题
引用 2 楼 fangmingshijie 的回复:

你应该设置持久化订阅了吧。有没有这句设置setDeliveryMode(DeliveryMode.PERSISTENT);

我比较怀疑是内存的问题
我同样的代码在有的机器上是没有这个问题的
不出错的电脑上启动信息最后两句是:
– Memory Usage for the Broker (64 mb) is more than the maximum available for the JVM: 63 mb
– Store limit is 102400 mb, whilst the data directory: D:\Java Workspace\OSGiConfig\activemq-data\localhost\KahaDB only has 77365 mb of usable space
Message broker started …. 

而出错的电脑是输出是:
– Store limit is 102400 mb, whilst the data directory: D:\Java Workspace\OSGiConfig\activemq-data\localhost\KahaDB only has 34421 mb of usable space
– Temporary Store limit is 51200 mb, whilst the temporary data directory: D:\Java Workspace\OSGiConfig\activemq-data\localhost\tmp_storage only has 34421 mb of usable space
Message broker started ….

应该是这么个问题吧?

ActiveMQ阻塞问题
折腾了这么久,原来是因为win7和XP系统有点区别。
xp下地址写为localhost,拔掉网线后也能在本机通信了
ActiveMQ阻塞问题
引用 2 楼 fangmingshijie 的回复:

你应该设置持久化订阅了吧。有没有这句设置setDeliveryMode(DeliveryMode.PERSISTENT);

就你一个回了,虽然是自己解决了 
分都给你得了


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明ActiveMQ阻塞问题
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!