下面的一段代码
factory = new PooledConnectionFactory(brokerURL);
connection = factory.createConnection("", "");
connection.start();
代理 URL 是有效主机,但端口未打开。 启动后进入无限重连循环
[junit] 00:28:54,851 WARN FailoverTransport:1109 - Failed to
connect to [SOME_URL] after: 10 attempt(s) continuing to retry.
[junit] 00:43:01,629 WARN FailoverTransport:1109 - Failed to
connect to [SOME_URL] after: 20 attempt(s) continuing to retry.
[junit] 00:58:02,531 WARN FailoverTransport:1109 - Failed to
connect to [SOME_URL] after: 30 attempt(s) continuing to retry.
[junit] 01:13:08,646 WARN FailoverTransport:1109 - Failed to
connect to [SOME_URL] after: 40 attempt(s) continuing to retry.
[junit] 01:28:10,021 WARN FailoverTransport:1109 - Failed to
connect to [SOME_URL] after: 50 attempt(s) continuing to retry.
如何设置重连次数或缩短重试间隔?
提前致谢
最佳答案
我使用的故障转移 URL 没有 maxReconnectAttempts(默认为永远重试)。
下面是故障转移 URL 上的 maxReconnectAttempts 示例
failover:(tcp://localhost:61616)?maxReconnectAttempts=10
关于java - PooledConnectionFactory 处于无限重新连接循环中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29010166/