@Override public void channelCreated(Channel ch) { /* Sometimes the Channel can be notified as created (by FixedChannelPool) but it actually fails to connect and the FixedChannelPool will decrement its active count, same as if it was released. The channel close promise is still invoked, which can lead to double-decrement and an assertion error. As such, it is best to only register the close handler on the channel in `PooledClientContextHandler`. see https://github.com/reactor/reactor-netty/issues/289 */ inactiveConnections.incrementAndGet(); if (log.isDebugEnabled()) { log.debug(format(ch, "Created new pooled channel, now {} active connections and {} inactive connections"), activeConnections, inactiveConnections); } PooledConnection pooledConnection = new PooledConnection(ch, this); pooledConnection.bind(); Bootstrap bootstrap = this.bootstrap.clone(); BootstrapHandlers.finalizeHandler(bootstrap, opsFactory, pooledConnection); ch.pipeline() .addFirst(bootstrap.config() .handler()); }
if (!isPersistent() && channel.isActive()) { owner().onStateChange(connection, State.DISCONNECTING); return; owner().onStateChange(connection, State.DISCONNECTING); owner().onStateChange(connection, newState);
c2.disposeNow(); sf = service.schedule(() -> c1.onStateChange(c1, ConnectionObserver.State.DISCONNECTING), 500, TimeUnit .MILLISECONDS); .isGreaterThanOrEqualTo(500); c3.onStateChange(c3, ConnectionObserver.State.DISCONNECTING); c4.onStateChange(c4, ConnectionObserver.State.DISCONNECTING);
if (!isPersistent() && channel.isActive()) { owner().onStateChange(connection, State.DISCONNECTING); return; owner().onStateChange(connection, State.DISCONNECTING); owner().onStateChange(connection, newState);
@Override public void channelCreated(Channel ch) { /* Sometimes the Channel can be notified as created (by FixedChannelPool) but it actually fails to connect and the FixedChannelPool will decrement its active count, same as if it was released. The channel close promise is still invoked, which can lead to double-decrement and an assertion error. As such, it is best to only register the close handler on the channel in `PooledClientContextHandler`. see https://github.com/reactor/reactor-netty/issues/289 */ inactiveConnections.incrementAndGet(); if (log.isDebugEnabled()) { log.debug(format(ch, "Created new pooled channel, now {} active connections and {} inactive connections"), activeConnections, inactiveConnections); } PooledConnection pooledConnection = new PooledConnection(ch, this); pooledConnection.bind(); Bootstrap bootstrap = this.bootstrap.clone(); BootstrapHandlers.finalizeHandler(bootstrap, opsFactory, pooledConnection); ch.pipeline() .addFirst(bootstrap.config() .handler()); }
@Override public void onUncaughtException(Connection connection, Throwable error) { owner().onUncaughtException(connection, error); }
@Override public Mono<Void> onTerminate() { return onTerminate.or(onDispose()); }
@Override public Context currentContext() { return owner().currentContext(); }
@Override public Mono<Void> onTerminate() { return onTerminate.or(onDispose()); }
@Override public Context currentContext() { return owner().currentContext(); }
@Override public void onUncaughtException(Connection connection, Throwable error) { owner().onUncaughtException(connection, error); }