public class BasicMultiNodeConnPool extends java.lang.Object implements NonBlockingConnPool
ATTR_KEY_NODE| Constructor and Description |
|---|
BasicMultiNodeConnPool(int concurrencyLevel,
java.util.concurrent.Semaphore concurrencyThrottle,
java.lang.String[] nodes,
io.netty.bootstrap.Bootstrap bootstrap,
io.netty.channel.pool.ChannelPoolHandler connPoolHandler,
int defaultPort,
int connAttemptsLimit) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected io.netty.channel.Channel |
connect(java.lang.String addr) |
io.netty.channel.Channel |
lease()
Get the connection immediately (don't block) or null.
|
int |
lease(java.util.List<io.netty.channel.Channel> conns,
int maxCount)
Get multiple connections immediately (don't block).
|
protected io.netty.channel.Channel |
poll() |
void |
release(io.netty.channel.Channel conn)
Release the connection back into the pool
|
void |
release(java.util.List<io.netty.channel.Channel> conns)
Release the connections back into the pool
|
public BasicMultiNodeConnPool(int concurrencyLevel,
java.util.concurrent.Semaphore concurrencyThrottle,
java.lang.String[] nodes,
io.netty.bootstrap.Bootstrap bootstrap,
io.netty.channel.pool.ChannelPoolHandler connPoolHandler,
int defaultPort,
int connAttemptsLimit)
protected io.netty.channel.Channel connect(java.lang.String addr)
throws java.lang.Exception
java.lang.Exceptionprotected io.netty.channel.Channel poll()
public final io.netty.channel.Channel lease()
throws ConnLeaseException
NonBlockingConnPoollease in interface NonBlockingConnPoolConnLeaseException - if no connections are in the pool and was unable to create new connectionpublic final int lease(java.util.List<io.netty.channel.Channel> conns,
int maxCount)
throws ConnLeaseException
NonBlockingConnPoollease in interface NonBlockingConnPoolconns - The output buffer to store the leased connectionsmaxCount - The count limitConnLeaseException - if no connections are in the pool and was unable to create new connectionpublic final void release(io.netty.channel.Channel conn)
NonBlockingConnPoolrelease in interface NonBlockingConnPoolpublic final void release(java.util.List<io.netty.channel.Channel> conns)
NonBlockingConnPoolrelease in interface NonBlockingConnPoolpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException