public final class HttpResources extends TcpResources
ConnectionProvider.Builder, ConnectionProvider.ConnectionPoolSpec<SPEC extends ConnectionProvider.ConnectionPoolSpec<SPEC>>, ConnectionProvider.HostSpecificSpec, ConnectionProvider.MeterRegistrar
Disposable.Composite, Disposable.Swap
DEFAULT_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_LIFO
DEFAULT_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(java.time.Duration quietPeriod,
java.time.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
|
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 resources.
|
static HttpResources |
set(LoopResources loops)
Update event loops resources and return the global HTTP resources.
|
_dispose, _disposeLater, _disposeLater, acquire, daemon, dispose, disposeLater, disposeWhen, getOrCreate, isDisposed, onChannel, onChannel, onChannelClass, onClient, onDatagramChannel, onServer, onServerChannel, onServerSelect, preferNative
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
builder, create, create, elastic, elastic, elastic, fixed, fixed, fixed, fixed, fixed, maxConnections, newConnection
colocate, create, create, create, disposeLater, hasNativeSupport
public static HttpResources get()
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 static HttpResources reset()
public 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 15s
Mono
triggering the disposeLoopsAndConnections()
when subscribed to.public static Mono<Void> disposeLoopsAndConnectionsLater(java.time.Duration quietPeriod, java.time.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.