public class PoolOptions extends Object
Constructor and Description |
---|
PoolOptions() |
PoolOptions(JsonObject json) |
PoolOptions(PoolOptions other) |
Modifier and Type | Method and Description |
---|---|
int |
getCleanerInterval()
Get how often the connection pool will be cleaned.
|
int |
getMaxSize()
Get the maximum size of the connection pool.
|
int |
getMaxWaiting()
Get the maximum number of requests waiting for a connection from the pool.
|
String |
getName()
Get the connection pool name to be used for metrics reporting.
|
int |
getRecycleTimeout()
Get how long a connection can stay unused before it is recycled during connection pool
cleaning.
|
PoolOptions |
setCleanerInterval(int cleanerInterval)
Set how often the connection pool will be cleaned.
|
PoolOptions |
setMaxSize(int maxSize)
Set the maximum size of the connection pool.
|
PoolOptions |
setMaxWaiting(int maxWaiting)
Set the maximum number of requests waiting for a connection from the pool.
|
PoolOptions |
setName(String name)
Set the connection pool name to be used for metrics reporting.
|
PoolOptions |
setRecycleTimeout(int recycleTimeout)
Set how long a connection can stay unused before it is recycled during connection pool
cleaning.
|
JsonObject |
toJson()
Converts this object to JSON notation.
|
public PoolOptions()
public PoolOptions(PoolOptions other)
public PoolOptions(JsonObject json)
public String getName()
public PoolOptions setName(String name)
name
- the pool namepublic int getCleanerInterval()
A connection is marked invalid if it enters a exception or fatal state. It is marked unused if it is unused for longer than the recycle timeout.
The return value is in milliseconds. By default, the cleaning interval is 30 seconds. The value of -1 means connection pool cleaning is disabled.
public PoolOptions setCleanerInterval(int cleanerInterval)
A connection is marked invalid if it enters a exception or fatal state. It is marked unused if it is unused for longer than the recycle timeout.
The value is in milliseconds. By default, the cleaning interval is 30 seconds. The value of -1 means connection pool cleaning is disabled.
cleanerInterval
- the cleaning interval in milliseconds, or -1 for neverpublic int getMaxSize()
By default, the maximum pool size is 6.
public PoolOptions setMaxSize(int maxSize)
By default, the maximum pool size is 6.
When working with cluster or sentinel, this value should be at least the total number of cluster member (or number of sentinels + 1).
maxSize
- the maximum pool sizepublic int getMaxWaiting()
By default, the maximum number of waiting requests size is 24.
public PoolOptions setMaxWaiting(int maxWaiting)
By default, the maximum number of waiting requests size is 24.
maxWaiting
- the maximum number of waiting requestspublic int getRecycleTimeout()
The value is in milliseconds. By default, the recycle timeout is 3 minutes. The value of -1 means connection recycling is disabled.
public PoolOptions setRecycleTimeout(int recycleTimeout)
The value is in milliseconds. By default, the recycle timeout is 3 minutes. The value of -1 means connection recycling is disabled.
recycleTimeout
- the recycle timeoutpublic JsonObject toJson()
Copyright © 2024 Eclipse. All rights reserved.