/** * Prepare to shutdown the global {@link TcpResources} without resetting them, * effectively cleaning up associated resources without creating new ones. This only * occurs when the returned {@link Mono} is subscribed to. * * @return a {@link Mono} triggering the {@link #disposeLoopsAndConnections()} when subscribed to. */ public static Mono<Void> disposeLoopsAndConnectionsLater() { return Mono.defer(() -> { TcpResources resources = tcpResources.getAndSet(null); if (resources != null) { return resources._disposeLater(); } return Mono.empty(); }); }
/** * Prepare to shutdown the global {@link TcpResources} without resetting them, * effectively cleaning up associated resources without creating new ones. This only * occurs when the returned {@link Mono} is subscribed to. * * @return a {@link Mono} triggering the {@link #disposeLoopsAndConnections()} when subscribed to. */ public static Mono<Void> disposeLoopsAndConnectionsLater() { return Mono.defer(() -> { TcpResources resources = tcpResources.getAndSet(null); if (resources != null) { return resources._disposeLater(); } return Mono.empty(); }); }