Top Description Inners Fields Methods
reactor.netty.resources

public Interface ConnectionProvider

extends Disposable
Known Direct Implementers
reactor.netty.resources.NewConnectionProvider, reactor.netty.resources.PooledConnectionProvider, reactor.netty.tcp.TcpResources
Annotations
@FunctionalInterface
Imports
io.netty.resolver.AddressResolverGroup, reactor.core.Disposable, reactor.core.publisher.Mono, reactor.core.scheduler.Schedulers, reactor.netty.Connection, .ConnectionObserver, .ReactorNetty, reactor.netty.internal.util.Metrics, reactor.netty.transport.TransportConfig, reactor.util.annotation.Nullable, java.net.SocketAddress, java.time.Duration, java.util.HashMap, .Locale, .Map, .Objects, java.util.concurrent.TimeoutException, java.util.function.BiFunction, .BiPredicate, .Consumer, .Supplier

A ConnectionProvider will produce Connection.
Author
Stephane Maldini
Since
0.8

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
public static class
ConnectionProvider.Builder

Build a ConnectionProvider to cache and reuse a fixed maximum number of Connection.

public static interface
public static class
ConnectionProvider.ConnectionPoolSpec<SPEC extends ConnectionProvider.ConnectionPoolSpec<SPEC>>

Configuration for a connection pool.

public static class
ConnectionProvider.HostSpecificSpec

Configuration for a connection pool per remote host.

public static interface
ConnectionProvider.MeterRegistrar

A strategy to register which metrics are collected in a particular connection pool.

Field Summary

Modifier and TypeField and Description
public static final long
DEFAULT_POOL_ACQUIRE_TIMEOUT

Default acquisition timeout (milliseconds) before error.

public static final String
DEFAULT_POOL_LEASING_STRATEGY

Default leasing strategy (fifo, lifo), fallback to fifo.

public static final int
DEFAULT_POOL_MAX_CONNECTIONS

Default max connections.

public static final long
DEFAULT_POOL_MAX_IDLE_TIME

Default max idle time, fallback - max idle time is not specified.

public static final long
DEFAULT_POOL_MAX_LIFE_TIME

Default max life time, fallback - max life time is not specified.

public static final String
LEASING_STRATEGY_FIFO

The connection selection is first in, first out.

public static final String
LEASING_STRATEGY_LIFO

The connection selection is last in, first out.

Method Summary

Modifier and TypeMethod and Description
public Mono<? extends Connection>

Returns:

an existing or new Mono of Connection
acquire
(TransportConfig
the transport configuration
config
,
ConnectionObserver connectionObserver, Supplier<? extends SocketAddress>
the SocketAddress to connect to
remoteAddress
,
AddressResolverGroup<?>
the resolver which will resolve the address of the unresolved named address
resolverGroup
)

Return an existing or new Connection on subscribe.

public static ConnectionProvider.Builder

Returns:

a new ConnectionProvider builder
builder
(String name)

Creates a builder for ConnectionProvider.

public static ConnectionProvider

Returns:

a new ConnectionProvider to cache and reuse a fixed maximum number of Connection
create
(String
the connection pool name
name
)

Create a new ConnectionProvider to cache and reuse a fixed maximum number of Connection.

public static ConnectionProvider

Returns:

a new ConnectionProvider to cache and reuse a fixed maximum number of Connection
create
(String
the connection pool name
name
,
int
the maximum number of connections before starting pending acquisition on existing ones
maxConnections
)

Create a new ConnectionProvider to cache and reuse a fixed maximum number of Connection.

public static ConnectionProvider

Returns:

a new ConnectionProvider to cache and reuse a fixed maximum number of Connection
create
(String
the connection pool name
name
,
int
the maximum number of connections before starting pending acquisition on existing ones
maxConnections
,
boolean
true enables metrics collection; false disables it
metricsEnabled
)

Create a new ConnectionProvider to cache and reuse a fixed maximum number of Connection.

public default void
dispose()

Implements reactor.core.Disposable.dispose.

Dispose this ConnectionProvider.
public default Mono<Void>

Returns:

a Mono representing the completion of the ConnectionProvider disposal.
disposeLater
()

Returns a Mono that triggers the disposal of the ConnectionProvider when subscribed to.

public default void
disposeWhen(SocketAddress
the remote address
remoteAddress
)

Dispose all connection pools for the specified remote address.

public default int

Returns:

the maximum number of connections before starting pending
maxConnections
()

Returns the maximum number of connections before starting pending.

public default Map<SocketAddress, Integer>

Returns:

the maximum number of connections per host before starting pending
maxConnectionsPerHost
()

Returns the maximum number of connections per host before starting pending.

public default ConnectionProvider.Builder

Returns:

a builder to mutate properties of this ConnectionProvider
mutate
()

Returns a builder to mutate properties of this ConnectionProvider.

public default String

Returns:

ConnectionProvider name used for metrics
name
()

Returns ConnectionProvider name used for metrics.

public static ConnectionProvider

Returns:

a ConnectionProvider that will always create a new Connection.
newConnection
()

Return a ConnectionProvider that will always create a new Connection.

Inherited from reactor.core.Disposable:
isDisposed