Package reactor.netty.http
Class HttpResources
java.lang.Object
reactor.netty.tcp.TcpResources
reactor.netty.http.HttpResources
- All Implemented Interfaces:
Disposable
,ConnectionProvider
,LoopResources
Hold the default HTTP/1.x resources.
- Since:
- 0.6
- Author:
- Stephane Maldini
-
Nested Class Summary
Nested classes/interfaces inherited from interface reactor.netty.resources.ConnectionProvider
ConnectionProvider.AllocationStrategy<A extends ConnectionProvider.AllocationStrategy<A>>, ConnectionProvider.Builder, ConnectionProvider.ConnectionMetadata, ConnectionProvider.ConnectionPoolSpec<SPEC extends ConnectionProvider.ConnectionPoolSpec<SPEC>>, ConnectionProvider.HostSpecificSpec, ConnectionProvider.MeterRegistrar
Nested classes/interfaces inherited from interface reactor.core.Disposable
Disposable.Composite, Disposable.Swap
-
Field Summary
Fields inherited from interface reactor.netty.resources.ConnectionProvider
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
Fields inherited from interface reactor.netty.resources.LoopResources
DEFAULT_IO_SELECT_COUNT, DEFAULT_IO_WORKER_COUNT, DEFAULT_NATIVE, DEFAULT_SHUTDOWN_QUIET_PERIOD, DEFAULT_SHUTDOWN_TIMEOUT
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Shutdown the globalHttpResources
without resetting them, effectively cleaning up associated resources without creating new ones.Prepare to shutdown the globalHttpResources
without resetting them, effectively cleaning up associated resources without creating new ones.disposeLoopsAndConnectionsLater
(Duration quietPeriod, Duration timeout) Prepare to shutdown the globalHttpResources
without resetting them, effectively cleaning up associated resources without creating new ones.void
disposeWhen
(SocketAddress remoteAddress) Dispose all connection pools for the specified remote address.static HttpResources
get()
Return the global HTTP resources for event loops and pooling.Safely checks whether a name resolver exists and proceed with a creation if it does not exist.Safely checks whether aConnectionProvider
for HTTP/2 traffic exists and proceed with a creation if it does not exist.Safely checks whether aConnectionProvider
for HTTP/3 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.Methods inherited from class reactor.netty.tcp.TcpResources
_dispose, _disposeLater, acquire, daemon, dispose, disposeLater, disposeLater, getOrCreate, isDisposed, maxConnections, maxConnectionsPerHost, mutate, name, onChannel, onChannelClass, onClient, onServer, onServerSelect
-
Method Details
-
disposeLoopsAndConnections
public static void disposeLoopsAndConnections()Shutdown the globalHttpResources
without resetting them, effectively cleaning up associated resources without creating new ones. This method is NOT blocking. It is implemented as fire-and-forget. UsedisposeLoopsAndConnectionsLater()
when you need to observe the final status of the operation, combined withMono.block()
if you need to synchronously wait for the underlying resources to be disposed. -
disposeLoopsAndConnectionsLater
Prepare to shutdown the globalHttpResources
without resetting them, effectively cleaning up associated resources without creating new ones. This only occurs when the returnedMono
is subscribed to. The quiet period will be2s
and the timeout will be15s
- Returns:
- a
Mono
triggering thedisposeLoopsAndConnections()
when subscribed to.
-
disposeLoopsAndConnectionsLater
Prepare to shutdown the globalHttpResources
without resetting them, effectively cleaning up associated resources without creating new ones. This only occurs when the returnedMono
is subscribed to. It is guaranteed that the disposal of the underlying LoopResources will not happen beforequietPeriod
is over. If a task is submitted during thequietPeriod
, it is guaranteed to be accepted and thequietPeriod
will start over.- Parameters:
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 period- Returns:
- a
Mono
triggering thedisposeLoopsAndConnections()
when subscribed to. - Since:
- 0.9.3
-
get
Return the global HTTP resources for event loops and pooling.- Returns:
- the global HTTP resources for event loops and pooling
-
reset
Reset http resources to default and return its instance.- Returns:
- the global HTTP resources
-
set
Update pooling resources and return the global HTTP/1.x resources. Note: The previousConnectionProvider
will be disposed.- Parameters:
provider
- a newConnectionProvider
to replace the current- Returns:
- the global HTTP/1.x resources
-
set
Update event loops resources and return the global HTTP/1.x resources. Note: The previousLoopResources
will be disposed.- Parameters:
loops
- a newLoopResources
to replace the current- Returns:
- the global HTTP/1.x resources
-
disposeWhen
Description copied from class:TcpResources
Dispose all connection pools for the specified remote address.As opposed to
TcpResources.dispose()
, this method delegates to the underlying connection provider. It has a global effect and removes all connection pools for this remote address from the global TCP resources (making it closer toTcpResources.disposeLoopsAndConnections()
than toTcpResources.dispose()
).- Specified by:
disposeWhen
in interfaceConnectionProvider
- Overrides:
disposeWhen
in classTcpResources
- Parameters:
remoteAddress
- the remote address
-
getOrCreateDefaultResolver
Description copied from class:TcpResources
Safely checks whether a name resolver exists and proceed with a creation if it does not exist. The name resolver uses as an event loop group theLoopResources
that are configured. Guarantees that always one and the same instance is returned for a givenLoopResources
and if theLoopResources
is updated the name resolver is also updated.- Overrides:
getOrCreateDefaultResolver
in classTcpResources
- Returns:
- an existing or new
AddressResolverGroup
-
getOrCreateHttp2ConnectionProvider
public ConnectionProvider getOrCreateHttp2ConnectionProvider(Function<ConnectionProvider, ConnectionProvider> create) Safely checks whether aConnectionProvider
for HTTP/2 traffic exists and proceed with a creation if it does not exist.- Parameters:
create
- the create function provides the currentConnectionProvider
for HTTP/1.1 traffic in case someConnectionProvider
configuration is needed.- Returns:
- an existing or new
ConnectionProvider
for HTTP/2 traffic - Since:
- 1.0.16
-
getOrCreateHttp3ConnectionProvider
public ConnectionProvider getOrCreateHttp3ConnectionProvider(Function<ConnectionProvider, ConnectionProvider> create) Safely checks whether aConnectionProvider
for HTTP/3 traffic exists and proceed with a creation if it does not exist.- Parameters:
create
- the create function provides the currentConnectionProvider
for HTTP/1.1 traffic in case someConnectionProvider
configuration is needed.- Returns:
- an existing or new
ConnectionProvider
for HTTP/3 traffic - Since:
- 1.2.0
-