public final class HttpResources extends TcpResources
ConnectionProvider.Builder, ConnectionProvider.ConnectionPoolSpec<SPEC extends ConnectionProvider.ConnectionPoolSpec<SPEC>>, ConnectionProvider.HostSpecificSpec, ConnectionProvider.MeterRegistrarDisposable.Composite, Disposable.SwapDEFAULT_POOL_ACQUIRE_TIMEOUT, DEFAULT_POOL_LEASING_STRATEGY, DEFAULT_POOL_MAX_CONNECTIONS, DEFAULT_POOL_MAX_IDLE_TIME, DEFAULT_POOL_MAX_LIFE_TIME, LEASING_STRATEGY_FIFO, LEASING_STRATEGY_LIFODEFAULT_IO_SELECT_COUNT, DEFAULT_IO_WORKER_COUNT, DEFAULT_NATIVE, DEFAULT_SHUTDOWN_QUIET_PERIOD, DEFAULT_SHUTDOWN_TIMEOUT| Modifier and Type | Method and Description |
|---|---|
static void |
disposeLoopsAndConnections()
Shutdown the global
HttpResources without resetting them,
effectively cleaning up associated resources without creating new ones. |
static Mono<Void> |
disposeLoopsAndConnectionsLater()
Prepare to shutdown the global
HttpResources without resetting them,
effectively cleaning up associated resources without creating new ones. |
static Mono<Void> |
disposeLoopsAndConnectionsLater(Duration quietPeriod,
Duration timeout)
Prepare to shutdown the global
HttpResources without resetting them,
effectively cleaning up associated resources without creating new ones. |
static HttpResources |
get()
Return the global HTTP resources for event loops and pooling
|
AddressResolverGroup<?> |
getOrCreateDefaultResolver()
Safely checks whether a name resolver exists and proceed with a creation if it does not exist.
|
ConnectionProvider |
getOrCreateHttp2ConnectionProvider(Function<ConnectionProvider,ConnectionProvider> create)
Safely checks whether a
ConnectionProvider for HTTP/2 traffic exists
and proceed with a creation if it does not exist. |
static HttpResources |
reset()
Reset http resources to default and return its instance
|
static HttpResources |
set(ConnectionProvider provider)
Update pooling resources and return the global HTTP/1.x resources.
|
static HttpResources |
set(LoopResources loops)
Update event loops resources and return the global HTTP/1.x resources.
|
_dispose, _disposeLater, acquire, daemon, dispose, disposeLater, disposeLater, disposeWhen, getOrCreate, isDisposed, maxConnections, maxConnectionsPerHost, mutate, name, onChannel, onChannelClass, onClient, onServer, onServerSelectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuilder, create, create, newConnectioncolocate, create, create, create, hasNativeSupportpublic static void disposeLoopsAndConnections()
HttpResources without resetting them,
effectively cleaning up associated resources without creating new ones.
This method is NOT blocking. It is implemented as fire-and-forget.
Use disposeLoopsAndConnectionsLater() when you need to observe
the final status of the operation, combined with Mono.block()
if you need to synchronously wait for the underlying resources to be disposed.public static Mono<Void> disposeLoopsAndConnectionsLater()
HttpResources without resetting them,
effectively cleaning up associated resources without creating new ones. This only
occurs when the returned Mono is subscribed to.
The quiet period will be 2s and the timeout will be 15sMono triggering the disposeLoopsAndConnections() when subscribed to.public static Mono<Void> disposeLoopsAndConnectionsLater(Duration quietPeriod, Duration timeout)
HttpResources without resetting them,
effectively cleaning up associated resources without creating new ones. This only
occurs when the returned Mono is subscribed to.
It is guaranteed that the disposal of the underlying LoopResources will not happen before
quietPeriod is over. If a task is submitted during the quietPeriod,
it is guaranteed to be accepted and the quietPeriod will start over.quietPeriod - the quiet period as described abovetimeout - the maximum amount of time to wait until the disposal of the underlying
LoopResources regardless if a task was submitted during the quiet periodMono triggering the disposeLoopsAndConnections() when subscribed to.public static HttpResources get()
public static HttpResources reset()
public static HttpResources set(ConnectionProvider provider)
ConnectionProvider will be disposed.provider - a new ConnectionProvider to replace the currentpublic static HttpResources set(LoopResources loops)
LoopResources will be disposed.loops - a new LoopResources to replace the currentpublic AddressResolverGroup<?> getOrCreateDefaultResolver()
TcpResourcesLoopResources that are configured.
Guarantees that always one and the same instance is returned for a given LoopResources
and if the LoopResources is updated the name resolver is also updated.getOrCreateDefaultResolver in class TcpResourcesAddressResolverGrouppublic ConnectionProvider getOrCreateHttp2ConnectionProvider(Function<ConnectionProvider,ConnectionProvider> create)
ConnectionProvider for HTTP/2 traffic exists
and proceed with a creation if it does not exist.create - the create function provides the current ConnectionProvider for HTTP/1.1 traffic
in case some ConnectionProvider configuration is needed.ConnectionProvider for HTTP/2 traffic