@Override public Mono<Void> onClose() { return connection .onDispose() .doFinally( s -> { if (!channelClosed.isDisposed()) { channelClosed.dispose(); } }); }
@Override public Mono<Void> onClose() { return connection .onDispose() .doFinally( s -> { if (!channelClosed.isDisposed()) { channelClosed.dispose(); } }); }
@Override public Connection onDispose(final Disposable onDispose) { connection.onDispose(onDispose); return this; }
/** * Return a Mono succeeding when a {@link Connection} is not used anymore by any * current operations. A typical example is when a pooled connection is released or * an operations bridge has terminated. * * @return a Mono succeeding when a {@link Connection} has been terminated */ default Mono<Void> onTerminate() { return onDispose(); }
/** * Return a Mono succeeding when a {@link Connection} is not used anymore by any * current operations. A typical example is when a pooled connection is released or * an operations bridge has terminated. * * @return a Mono succeeding when a {@link Connection} has been terminated */ default Mono<Void> onTerminate() { return onDispose(); }
@Override public Connection onDispose(final Disposable onDispose) { connection.onDispose(onDispose); return this; }
@Override public final Mono<Void> onDispose() { return connection.onDispose(); }
@Override public final Mono<Void> onDispose() { return connection.onDispose(); }
public Mono<Void> onClose() { return connection.onDispose(); }
@Override public void onStateChange(Connection connection, State newState) { if (onBound != null && newState == State.CONFIGURED) { onBound.accept(connection); return; } if (onUnbound != null && newState == State.DISCONNECTING) { connection.onDispose(() -> onUnbound.accept(connection)); } } }
@Override public void onStateChange(Connection connection, State newState) { if (onBound != null && newState == State.CONFIGURED) { onBound.accept(connection); return; } if (onUnbound != null && newState == State.DISCONNECTING) { connection.onDispose(() -> onUnbound.accept(connection)); } } }
@Override public void onStateChange(Connection connection, State newState) { if (onConnected != null && newState == State.CONFIGURED) { onConnected.accept(connection); return; } if (onDisconnected != null) { if (newState == State.DISCONNECTING) { connection.onDispose(() -> onDisconnected.accept(connection)); } else if (newState == State.RELEASED) { onDisconnected.accept(connection); } } } }
@Override public void onStateChange(Connection connection, State newState) { if (onConnected != null && newState == State.CONFIGURED) { onConnected.accept(connection); return; } if (onDisconnected != null) { if (newState == State.DISCONNECTING) { connection.onDispose(() -> onDisconnected.accept(connection)); } else if (newState == State.RELEASED) { onDisconnected.accept(connection); } } } }
@Override public void onStateChange(Connection connection, State newState) { if (onConnected != null && newState == State.CONFIGURED) { onConnected.accept(connection); return; } if (onDisconnected != null) { if (newState == State.DISCONNECTING) { connection.onDispose(() -> onDisconnected.accept(connection)); } else if (newState == State.RELEASED) { onDisconnected.accept(connection); } } } }
@Override public void onStateChange(Connection connection, State newState) { if (onConnected != null && newState == State.CONFIGURED) { onConnected.accept(connection); return; } if (onDisconnected != null) { if (newState == State.DISCONNECTING) { connection.onDispose(() -> onDisconnected.accept(connection)); } else if (newState == State.RELEASED) { onDisconnected.accept(connection); } } } }
/** * Return a Mono succeeding when a {@link ChannelOperations} has been terminated * * @return a Mono succeeding when a {@link ChannelOperations} has been terminated */ @Override public final Mono<Void> onTerminate() { if (!isPersistent()) { return connection.onDispose(); } return FutureMono.from((Future<Void>)this).or(connection.onDispose()); }
/** * Return a Mono succeeding when a {@link ChannelOperations} has been terminated * * @return a Mono succeeding when a {@link ChannelOperations} has been terminated */ @Override public final Mono<Void> onTerminate() { if (!isPersistent()) { return connection.onDispose(); } return FutureMono.from((Future<Void>)this).or(connection.onDispose()); }
@Override public Mono<Void> onClose() { return connection .onDispose() .doFinally( s -> { if (!channelClosed.isDisposed()) { channelClosed.dispose(); } }); }
@Override public Mono<Void> onClose() { return connection .onDispose() .doFinally( s -> { if (!channelClosed.isDisposed()) { channelClosed.dispose(); } }); }
/** * Lambda setter for reacting on channel close occurrence. * * @param disposable function to run when disposable would take place */ public Mono<Void> onClose(Disposable disposable) { return Mono.create( sink -> inbound.withConnection( connection -> connection .onDispose(disposable) .onTerminate() .subscribe(sink::success, sink::error, sink::success))); }