@Override public Mono<Void> onClose() { return channel.onDispose(); } }
@Override public Mono<Void> onClose() { return channel.onDispose(); } }
@Override default Connection onDispose(Disposable onDispose) { DisposableChannel.super.onDispose(onDispose); return this; }
@Override default Connection onDispose(Disposable onDispose) { DisposableChannel.super.onDispose(onDispose); return this; }
@Override protected void hookOnSubscribe(Subscription subscription) { request(Long.MAX_VALUE); channelDisposable.onDispose(this); }
@Override protected void hookOnSubscribe(Subscription subscription) { request(Long.MAX_VALUE); channelDisposable.onDispose(this); }
/** * Release or close the underlying {@link Channel} in a blocking fashion */ default void disposeNow(Duration timeout) { if (isDisposed()) { return; } dispose(); try { onDispose().block(timeout); } catch (Exception e) { throw new IllegalStateException("Socket couldn't be stopped within " + timeout.toMillis() + "ms"); } }
/** * Release or close the underlying {@link Channel} in a blocking fashion */ default void disposeNow(Duration timeout) { if (isDisposed()) { return; } dispose(); try { onDispose().block(timeout); } catch (Exception e) { throw new IllegalStateException("Socket couldn't be stopped within " + timeout.toMillis() + "ms"); } }
/** * Assign a {@link Disposable} to be invoked when the channel is closed. * * @param onDispose the close event handler * * @return {@literal this} */ default DisposableChannel onDispose(Disposable onDispose) { onDispose().subscribe(null, e -> onDispose.dispose(), onDispose::dispose); return this; }
/** * Assign a {@link Disposable} to be invoked when the channel is closed. * * @param onDispose the close event handler * * @return {@literal this} */ default DisposableChannel onDispose(Disposable onDispose) { onDispose().subscribe(null, e -> onDispose.dispose(), onDispose::dispose); return this; }