PooledConnectionFactory 在无休止的重新连接循环中

PooledConnectionFactory in endless reconnect loop

下面的一段代码

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.

如何设置重连次数或减少重试间隔?

提前致谢

我正在使用没有 maxReconnectAttempts 的故障转移 URL(默认为永远重试)。

下面是故障转移时 maxReconnectAttempts 的示例 URL

failover:(tcp://localhost:61616)?maxReconnectAttempts=10