Skip to content

Commit 792d1b6

Browse files
committed
Set timeout on NIO connection
Fixes #720 (cherry picked from commit 510389e)
1 parent ed5a9e1 commit 792d1b6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,11 @@ public class SocketChannelFrameHandlerFactory extends AbstractFrameHandlerFactor
5858

5959
private final List<NioLoopContext> nioLoopContexts;
6060

61-
public SocketChannelFrameHandlerFactory(int connectionTimeout, NioParams nioParams, boolean ssl, SslContextFactory sslContextFactory)
62-
throws IOException {
61+
public SocketChannelFrameHandlerFactory(int connectionTimeout, NioParams nioParams, boolean ssl, SslContextFactory sslContextFactory) {
6362
super(connectionTimeout, null, ssl);
6463
this.nioParams = new NioParams(nioParams);
6564
this.sslContextFactory = sslContextFactory;
66-
this.nioLoopContexts = new ArrayList<NioLoopContext>(this.nioParams.getNbIoThreads());
65+
this.nioLoopContexts = new ArrayList<>(this.nioParams.getNbIoThreads());
6766
for (int i = 0; i < this.nioParams.getNbIoThreads(); i++) {
6867
this.nioLoopContexts.add(new NioLoopContext(this, this.nioParams));
6968
}
@@ -96,7 +95,7 @@ public FrameHandler create(Address addr, String connectionName) throws IOExcepti
9695
nioParams.getSocketChannelConfigurator().configure(channel);
9796
}
9897

99-
channel.connect(address);
98+
channel.socket().connect(address, this.connectionTimeout);
10099

101100

102101
if (ssl) {

0 commit comments

Comments
 (0)