Class PoolOptions
java.lang.Object
io.vertx.sqlclient.PoolOptions
The options for configuring a connection pool.
- Author:
- Julien Viet
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault connection timeout in the pool = 30 secondsstatic final TimeUnitDefault connection idle time unit in the pool = secondsstatic final intDefault pool event loop size = 0 (reuse current event-loop)static final intDefault connection timeout in the pool = 0 (no timeout)static final TimeUnitDefault connection idle time unit in the pool = secondsstatic final intThe default maximum number of connections a client will pool = 4static final intDefault max wait queue size = -1 (unbounded)static final intDefault maximum pooled connection lifetime = 0 (no maximum)static final TimeUnitDefault maximum pooled connection lifetime unit = secondsstatic final StringActual name of anonymous shared pool =__vertx.DEFAULTstatic final intDefault pool cleaner period = 1000 ms (1 second)static final booleanDefault shared pool config =false -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintintintintintintgetName()intinthashCode()booleanisShared()setConnectionTimeout(int timeout) Set the amount of time a client will wait for a connection from the pool.setConnectionTimeoutUnit(TimeUnit timeoutUnit) Set the time unit ofsetConnectionTimeout(int)setEventLoopSize(int eventLoopSize) Set the number of event-loop the pool use.setIdleTimeout(int idleTimeout) Establish an idle timeout for pooled connections, a value of zero disables the idle timeout.setIdleTimeoutUnit(TimeUnit idleTimeoutUnit) Establish an idle timeout unit for pooled connections.setMaxLifetime(int maxLifetime) Establish a max lifetime for pooled connections, a value of zero disables the maximum lifetime.setMaxLifetimeUnit(TimeUnit maxLifetimeUnit) Establish a max lifetime unit for pooled connections.setMaxSize(int maxSize) Set the maximum pool sizesetMaxWaitQueueSize(int maxWaitQueueSize) Set the maximum connection request allowed in the wait queue, any requests beyond the max size will result in an failure.Set the pool name, used when the pool shared, otherwise ignored.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.setShared(boolean shared) Set totrueto share the pool.toJson()
-
Field Details
-
DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_SIZEThe default maximum number of connections a client will pool = 4- See Also:
-
DEFAULT_MAX_WAIT_QUEUE_SIZE
public static final int DEFAULT_MAX_WAIT_QUEUE_SIZEDefault max wait queue size = -1 (unbounded)- See Also:
-
DEFAULT_IDLE_TIMEOUT
public static final int DEFAULT_IDLE_TIMEOUTDefault connection timeout in the pool = 0 (no timeout)- See Also:
-
DEFAULT_MAXIMUM_LIFETIME
public static final int DEFAULT_MAXIMUM_LIFETIMEDefault maximum pooled connection lifetime = 0 (no maximum)- See Also:
-
DEFAULT_IDLE_TIMEOUT_TIME_UNIT
Default connection idle time unit in the pool = seconds -
DEFAULT_MAXIMUM_LIFETIME_TIME_UNIT
Default maximum pooled connection lifetime unit = seconds -
DEFAULT_POOL_CLEANER_PERIOD
public static final int DEFAULT_POOL_CLEANER_PERIODDefault pool cleaner period = 1000 ms (1 second)- See Also:
-
DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_CONNECTION_TIMEOUTDefault connection timeout in the pool = 30 seconds- See Also:
-
DEFAULT_CONNECTION_TIMEOUT_TIME_UNIT
Default connection idle time unit in the pool = seconds -
DEFAULT_SHARED_POOL
public static final boolean DEFAULT_SHARED_POOLDefault shared pool config =false- See Also:
-
DEFAULT_NAME
Actual name of anonymous shared pool =__vertx.DEFAULT- See Also:
-
DEFAULT_EVENT_LOOP_SIZE
public static final int DEFAULT_EVENT_LOOP_SIZEDefault pool event loop size = 0 (reuse current event-loop)- See Also:
-
-
Constructor Details
-
PoolOptions
public PoolOptions() -
PoolOptions
-
PoolOptions
-
-
Method Details
-
getMaxSize
public int getMaxSize()- Returns:
- the maximum pool size
-
setMaxSize
Set the maximum pool size- Parameters:
maxSize- the maximum pool size- Returns:
- a reference to this, so the API can be used fluently
-
getMaxWaitQueueSize
public int getMaxWaitQueueSize()- Returns:
- the maximum wait queue size
-
setMaxWaitQueueSize
Set the maximum connection request allowed in the wait queue, any requests beyond the max size will result in an failure. If the value is set to a negative number then the queue will be unbounded.- Parameters:
maxWaitQueueSize- the maximum number of waiting requests- Returns:
- a reference to this, so the API can be used fluently
-
getIdleTimeoutUnit
- Returns:
- the pooled connection idle timeout unit
-
setIdleTimeoutUnit
Establish an idle timeout unit for pooled connections.- Parameters:
idleTimeoutUnit- pooled connection idle time unit- Returns:
- a reference to this, so the API can be used fluently
-
getIdleTimeout
public int getIdleTimeout()- Returns:
- pooled connection idle timeout
-
setIdleTimeout
Establish an idle timeout for pooled connections, a value of zero disables the idle timeout.- Parameters:
idleTimeout- the pool connection idle timeout- Returns:
- a reference to this, so the API can be used fluently
-
getMaxLifetimeUnit
- Returns:
- the pooled connection max lifetime unit
-
setMaxLifetimeUnit
Establish a max lifetime unit for pooled connections.- Parameters:
maxLifetimeUnit- pooled connection max lifetime unit- Returns:
- a reference to this, so the API can be used fluently
-
getMaxLifetime
public int getMaxLifetime()- Returns:
- pooled connection max lifetime
-
setMaxLifetime
Establish a max lifetime for pooled connections, a value of zero disables the maximum lifetime.- Parameters:
maxLifetime- the pool connection max lifetime- Returns:
- a reference to this, so the API can be used fluently
-
getPoolCleanerPeriod
public int getPoolCleanerPeriod()- Returns:
- the connection pool cleaner period in ms.
-
setPoolCleanerPeriod
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.- Parameters:
poolCleanerPeriod- the pool cleaner period- Returns:
- a reference to this, so the API can be used fluently
-
getConnectionTimeoutUnit
- Returns:
- the time unit of @link #setConnectionTimeout(int)}
-
setConnectionTimeoutUnit
Set the time unit ofsetConnectionTimeout(int)- Parameters:
timeoutUnit- the time unit- Returns:
- a reference to this, so the API can be used fluently
-
getConnectionTimeout
public int getConnectionTimeout()- Returns:
- the amount of time a client will wait for a connection from the pool. See
setConnectionTimeout(int)
-
setConnectionTimeout
Set the amount of time a client will wait for a connection from the pool. If the time is exceeded without a connection available, an exception is provided.- Parameters:
timeout- the pool connection idle time unit- Returns:
- a reference to this, so the API can be used fluently
-
getName
- Returns:
- the pool name
-
setName
Set the pool name, used when the pool shared, otherwise ignored.- Parameters:
name- the new name- Returns:
- a reference to this, so the API can be used fluently
-
getEventLoopSize
public int getEventLoopSize()- Returns:
- the max number of event-loop a pool will use, the default value is
0which implies to reuse the current event-loop
-
setEventLoopSize
Set the number of event-loop the pool use.- when the size is
0, the client pool will use the current event-loop - otherwise the client will create and use its own event loop
0.- Parameters:
eventLoopSize- the new size- Returns:
- a reference to this, so the API can be used fluently
- when the size is
-
toJson
-
equals
-
hashCode
-