Skip to content

Commit 015bcfe

Browse files
committed
Avoid blocking on failed connections at shutdown.
This is a workaround for Netty bug 3464, which will be fixed in 4.0.27.Final.
1 parent 083600a commit 015bcfe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

driver-core/src/main/java/com/datastax/driver/core/Connection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ protected Connection(String name, InetSocketAddress address, Factory factory) th
115115
try {
116116
// Wait until the connection attempt succeeds or fails.
117117
this.channel = future.awaitUninterruptibly().channel();
118-
this.factory.allChannels.add(this.channel);
119118
if (!future.isSuccess()) {
120119
if (logger.isDebugEnabled())
121120
logger.debug(String.format("%s Error connecting to %s%s", this, address, extractMessage(future.cause())));
122121
throw defunct(new TransportException(address, "Cannot connect", future.cause()));
123122
}
123+
this.factory.allChannels.add(this.channel);
124124
channel.closeFuture().addListener(new ChannelCloseListener());
125125
} finally {
126126
writer.decrementAndGet();

0 commit comments

Comments
 (0)