Skip to content

Commit 2b4a4d7

Browse files
committed
Simplify calculation of shutdown timeout
Fixes #194
1 parent 98cfd3b commit 2b4a4d7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/com/rabbitmq/client/impl/AMQConnection.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ public void start()
393393
protected ChannelManager instantiateChannelManager(int channelMax, ThreadFactory threadFactory) {
394394
ChannelManager result = new ChannelManager(this._workService, channelMax, threadFactory, this.metricsCollector);
395395
result.setShutdownExecutor(this.shutdownExecutor);
396-
result.setChannelShutdownTimeout((int) (requestedHeartbeat * 1000.0 + requestedHeartbeat * 1000.0 * (5.0 / 100.0)));
396+
result.setChannelShutdownTimeout((int) ((requestedHeartbeat * 1.05) * 1000));
397397
return result;
398398
}
399399

src/main/java/com/rabbitmq/client/impl/ChannelManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class ChannelManager {
5252
private ExecutorService shutdownExecutor;
5353
private final ThreadFactory threadFactory;
5454

55-
private int channelShutdownTimeout = (int) (ConnectionFactory.DEFAULT_HEARTBEAT + ConnectionFactory.DEFAULT_HEARTBEAT * (5.0 / 100.0)) * 1000;
55+
private int channelShutdownTimeout = (int) ((ConnectionFactory.DEFAULT_HEARTBEAT * 1.05) * 1000);
5656

5757
protected final MetricsCollector metricsCollector;
5858

0 commit comments

Comments
 (0)