@FunctionalInterface
public interface PoolResources
extends reactor.core.Disposable
ChannelPool selector with associated factories.| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_POOL_ACQUIRE_TIMEOUT
Default acquisition timeout before error.
|
static int |
DEFAULT_POOL_MAX_CONNECTION
Default max connection, if -1 will never wait to acquire before opening new
connection in an unbounded fashion.
|
| Modifier and Type | Method and Description |
|---|---|
default void |
dispose() |
default reactor.core.publisher.Mono<java.lang.Void> |
disposeLater()
Returns a Mono that triggers the disposal of underlying resources when subscribed to.
|
static PoolResources |
elastic(java.lang.String name)
Create an uncapped
PoolResources to provide automatically for ChannelPool. |
static PoolResources |
fixed(java.lang.String name)
Create a capped
PoolResources to provide automatically for ChannelPool. |
static PoolResources |
fixed(java.lang.String name,
int maxConnections)
Create a capped
PoolResources to provide automatically for ChannelPool. |
static PoolResources |
fixed(java.lang.String name,
int maxConnections,
long acquireTimeout)
Create a capped
PoolResources to provide automatically for ChannelPool. |
io.netty.channel.pool.ChannelPool |
selectOrCreate(java.net.SocketAddress address,
java.util.function.Supplier<? extends io.netty.bootstrap.Bootstrap> bootstrap,
java.util.function.Consumer<? super io.netty.channel.Channel> onChannelCreate,
io.netty.channel.EventLoopGroup group)
Return an existing or new
ChannelPool. |
static final int DEFAULT_POOL_MAX_CONNECTION
static final long DEFAULT_POOL_ACQUIRE_TIMEOUT
static PoolResources elastic(java.lang.String name)
PoolResources to provide automatically for ChannelPool.
An elastic PoolResources will never wait before opening a new
connection. The reuse window is limited but it cannot starve an undetermined volume
of clients using it.
name - the channel pool map namePoolResources to provide automatically for ChannelPoolstatic PoolResources fixed(java.lang.String name)
PoolResources to provide automatically for ChannelPool.
A Fixed PoolResources will open up to the given max number of
processors observed by this jvm (minimum 4).
Further connections will be pending acquisition indefinitely.
name - the channel pool map namePoolResources to provide automatically for ChannelPoolstatic PoolResources fixed(java.lang.String name, int maxConnections)
PoolResources to provide automatically for ChannelPool.
A Fixed PoolResources will open up to the given max connection value.
Further connections will be pending acquisition indefinitely.
name - the channel pool map namemaxConnections - the maximum number of connections before starting pending
acquisition on existing onesPoolResources to provide automatically for ChannelPoolstatic PoolResources fixed(java.lang.String name, int maxConnections, long acquireTimeout)
PoolResources to provide automatically for ChannelPool.
A Fixed PoolResources will open up to the given max connection value.
Further connections will be pending acquisition indefinitely.
name - the channel pool map namemaxConnections - the maximum number of connections before starting pendingacquireTimeout - the maximum time in millis to wait for aquiringPoolResources to provide automatically for ChannelPoolio.netty.channel.pool.ChannelPool selectOrCreate(java.net.SocketAddress address,
java.util.function.Supplier<? extends io.netty.bootstrap.Bootstrap> bootstrap,
java.util.function.Consumer<? super io.netty.channel.Channel> onChannelCreate,
io.netty.channel.EventLoopGroup group)
ChannelPool. The implementation will take care
of pulling Bootstrap lazily when a ChannelPool creation is actually
needed.address - the remote address to resolve for existing or
new ChannelPoolbootstrap - the Bootstrap supplier if a ChannelPool must be
createdonChannelCreate - callback only when new connection is madeChannelPooldefault void dispose()
dispose in interface reactor.core.Disposabledefault reactor.core.publisher.Mono<java.lang.Void> disposeLater()