ActiveMQ重新启动ActiveMQ后无法重新连接。不确定如何编码
ActivemqBrokerInfo的行为不应单例。如果activemq发生故障,则一旦重新启动activemq,现有的ActivemqBrokerInfo不再有效,则需要重新创建它。需要在现有对象上执行testConnection()来查看是否需要重新创建它。
public class JmsBroker {
private static ActivemqBrokerInfo staticBroker;
public static JmsBrokerInfo getBrokerInfo(String jmsHost) {
if(staticBroker == null) {
staticBroker = new ActivemqBrokerInfo(jmsHost);
}
return staticBroker;
}