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.MeterRegistrarNested 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_LIFOFields 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 voidShutdown the globalHttpResourceswithout resetting them, effectively cleaning up associated resources without creating new ones.Prepare to shutdown the globalHttpResourceswithout resetting them, effectively cleaning up associated resources without creating new ones.disposeLoopsAndConnectionsLater(Duration quietPeriod, Duration timeout) Prepare to shutdown the globalHttpResourceswithout resetting them, effectively cleaning up associated resources without creating new ones.voiddisposeWhen(SocketAddress remoteAddress) Dispose all connection pools for the specified remote address.static HttpResourcesget()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 aConnectionProviderfor HTTP/2 traffic exists and proceed with a creation if it does not exist.Safely checks whether aConnectionProviderfor HTTP/3 traffic exists and proceed with a creation if it does not exist.static HttpResourcesreset()Reset http resources to default and return its instance.static HttpResourcesset(ConnectionProvider provider) Update pooling resources and return the global HTTP/1.x resources.static HttpResourcesset(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 globalHttpResourceswithout 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 globalHttpResourceswithout resetting them, effectively cleaning up associated resources without creating new ones. This only occurs when the returnedMonois subscribed to. The quiet period will be2sand the timeout will be15s- Returns:
- a
Monotriggering thedisposeLoopsAndConnections()when subscribed to.
-
disposeLoopsAndConnectionsLater
Prepare to shutdown the globalHttpResourceswithout resetting them, effectively cleaning up associated resources without creating new ones. This only occurs when the returnedMonois subscribed to. It is guaranteed that the disposal of the underlying LoopResources will not happen beforequietPeriodis over. If a task is submitted during thequietPeriod, it is guaranteed to be accepted and thequietPeriodwill 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
Monotriggering 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 previousConnectionProviderwill be disposed.- Parameters:
provider- a newConnectionProviderto 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 previousLoopResourceswill be disposed.- Parameters:
loops- a newLoopResourcesto replace the current- Returns:
- the global HTTP/1.x resources
-
disposeWhen
Description copied from class:TcpResourcesDispose 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:
disposeWhenin interfaceConnectionProvider- Overrides:
disposeWhenin classTcpResources- Parameters:
remoteAddress- the remote address
-
getOrCreateDefaultResolver
Description copied from class:TcpResourcesSafely 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 theLoopResourcesthat are configured. Guarantees that always one and the same instance is returned for a givenLoopResourcesand if theLoopResourcesis updated the name resolver is also updated.- Overrides:
getOrCreateDefaultResolverin classTcpResources- Returns:
- an existing or new
AddressResolverGroup
-
getOrCreateHttp2ConnectionProvider
public ConnectionProvider getOrCreateHttp2ConnectionProvider(Function<ConnectionProvider, ConnectionProvider> create) Safely checks whether aConnectionProviderfor HTTP/2 traffic exists and proceed with a creation if it does not exist.- Parameters:
create- the create function provides the currentConnectionProviderfor HTTP/1.1 traffic in case someConnectionProviderconfiguration is needed.- Returns:
- an existing or new
ConnectionProviderfor HTTP/2 traffic - Since:
- 1.0.16
-
getOrCreateHttp3ConnectionProvider
public ConnectionProvider getOrCreateHttp3ConnectionProvider(Function<ConnectionProvider, ConnectionProvider> create) Safely checks whether aConnectionProviderfor HTTP/3 traffic exists and proceed with a creation if it does not exist.- Parameters:
create- the create function provides the currentConnectionProviderfor HTTP/1.1 traffic in case someConnectionProviderconfiguration is needed.- Returns:
- an existing or new
ConnectionProviderfor HTTP/3 traffic - Since:
- 1.2.0
-