public class PoolOptions extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CONNECTION_TIMEOUT
Default connection timeout in the pool = 30 seconds
|
static TimeUnit |
DEFAULT_CONNECTION_TIMEOUT_TIME_UNIT
Default connection idle time unit in the pool = seconds
|
static int |
DEFAULT_EVENT_LOOP_SIZE
Default pool event loop size = 0 (reuse current event-loop)
|
static int |
DEFAULT_IDLE_TIMEOUT
Default connection timeout in the pool = 0 (no timeout)
|
static TimeUnit |
DEFAULT_IDLE_TIMEOUT_TIME_UNIT
Default connection idle time unit in the pool = seconds
|
static int |
DEFAULT_MAX_SIZE
The default maximum number of connections a client will pool = 4
|
static int |
DEFAULT_MAX_WAIT_QUEUE_SIZE
Default max wait queue size = -1 (unbounded)
|
static String |
DEFAULT_NAME
Actual name of anonymous shared pool =
__vertx.DEFAULT |
static int |
DEFAULT_POOL_CLEANER_PERIOD
Default pool cleaner period = 1000 ms (1 second)
|
static boolean |
DEFAULT_SHARED_POOL
Default shared pool config =
false |
Constructor and Description |
---|
PoolOptions() |
PoolOptions(JsonObject json) |
PoolOptions(PoolOptions other) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
getConnectionTimeout() |
TimeUnit |
getConnectionTimeoutUnit() |
int |
getEventLoopSize() |
int |
getIdleTimeout() |
TimeUnit |
getIdleTimeoutUnit() |
int |
getMaxSize() |
int |
getMaxWaitQueueSize() |
String |
getName() |
int |
getPoolCleanerPeriod() |
int |
hashCode() |
boolean |
isShared() |
PoolOptions |
setConnectionTimeout(int timeout)
Set the amount of time a client will wait for a connection from the pool.
|
PoolOptions |
setConnectionTimeoutUnit(TimeUnit timeoutUnit)
Set the time unit of
setConnectionTimeout(int) |
PoolOptions |
setEventLoopSize(int eventLoopSize)
Set the number of event-loop the pool use.
|
PoolOptions |
setIdleTimeout(int idleTimeout)
Establish an idle timeout for pooled connections.
|
PoolOptions |
setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
Establish an idle timeout unit for pooled connections.
|
PoolOptions |
setMaxSize(int maxSize)
Set the maximum pool size
|
PoolOptions |
setMaxWaitQueueSize(int maxWaitQueueSize)
Set the maximum connection request allowed in the wait queue, any requests beyond the max size will result in
an failure.
|
PoolOptions |
setName(String name)
Set the pool name, used when the pool shared, otherwise ignored.
|
PoolOptions |
setPoolCleanerPeriod(int poolCleanerPeriod)
Set the connection pool cleaner period in milli seconds, a non positive value disables expiration checks and connections
will remain in the pool until they are closed.
|
PoolOptions |
setShared(boolean shared)
Set to
true to share the pool. |
JsonObject |
toJson() |
public static final int DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_WAIT_QUEUE_SIZE
public static final int DEFAULT_IDLE_TIMEOUT
public static final TimeUnit DEFAULT_IDLE_TIMEOUT_TIME_UNIT
public static final int DEFAULT_POOL_CLEANER_PERIOD
public static final int DEFAULT_CONNECTION_TIMEOUT
public static final TimeUnit DEFAULT_CONNECTION_TIMEOUT_TIME_UNIT
public static final boolean DEFAULT_SHARED_POOL
false
public static final String DEFAULT_NAME
__vertx.DEFAULT
public static final int DEFAULT_EVENT_LOOP_SIZE
public PoolOptions()
public PoolOptions(JsonObject json)
public PoolOptions(PoolOptions other)
public int getMaxSize()
public PoolOptions setMaxSize(int maxSize)
maxSize
- the maximum pool sizepublic int getMaxWaitQueueSize()
public PoolOptions setMaxWaitQueueSize(int maxWaitQueueSize)
maxWaitQueueSize
- the maximum number of waiting requestspublic TimeUnit getIdleTimeoutUnit()
public PoolOptions setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
idleTimeoutUnit
- pooled connection idle time unitpublic int getIdleTimeout()
public PoolOptions setIdleTimeout(int idleTimeout)
idleTimeout
- the pool connection idle time unitqpublic int getPoolCleanerPeriod()
public PoolOptions setPoolCleanerPeriod(int poolCleanerPeriod)
poolCleanerPeriod
- the pool cleaner periodpublic TimeUnit getConnectionTimeoutUnit()
public PoolOptions setConnectionTimeoutUnit(TimeUnit timeoutUnit)
setConnectionTimeout(int)
timeoutUnit
- the time unitpublic int getConnectionTimeout()
setConnectionTimeout(int)
public PoolOptions setConnectionTimeout(int timeout)
timeout
- the pool connection idle time unitpublic boolean isShared()
public PoolOptions setShared(boolean shared)
true
to share the pool.
There can be multiple shared pools distinguished by getName()
, when no specific
name is set, the DEFAULT_NAME
is used.
shared
- true
to use a shared poolpublic String getName()
public PoolOptions setName(String name)
name
- the new namepublic int getEventLoopSize()
0
which implies
to reuse the current event-looppublic PoolOptions setEventLoopSize(int eventLoopSize)
0
, the client pool will use the current event-loop0
.eventLoopSize
- the new sizepublic JsonObject toJson()
Copyright © 2022 Eclipse. All rights reserved.