Constructor and Description |
---|
DatasourceOptions() |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Clone the current options.
|
int |
getCacheLimit()
Get the cache size limit of the session.
|
int |
getCheckInterval()
Get the interval for checking the idle connections periodically.
|
ConnectStrategy |
getConnectStrategy()
Get the current strategy of creating connections.
|
int |
getDeltaIncCount()
Get the number of connections to create once running out the
connection pool.
|
int |
getKeepAliveTimeout()
Get the setup time for abandoning a connection
which has not been used for long time.
|
int |
getMaxCount()
Get the capacity of the pool.
|
int |
getMaxIdleCount()
Get the maximum number of idle connections.
|
int |
getMinIdleCount()
Get the minimum number of idle connections.
|
int |
getNetworkBlockTimeout()
Get the network block timeout
|
List<String> |
getPreferredInstance()
Get the preferred instance.
|
String |
getPreferredInstanceMode()
Get the preferred instance node.
|
int |
getSessionTimeout()
The Session timeout value.
|
int |
getSyncCoordInterval()
Get the interval for updating coord's addresses from catalog periodically.
|
boolean |
getValidateConnection()
Get whether to validate a connection which is got from the pool or not.
|
void |
setCacheLimit(int limitBytes)
Set the cache size limit of the session.
|
void |
setCheckInterval(int checkInterval)
Set the checking interval in milliseconds.
|
void |
setConnectStrategy(ConnectStrategy strategy)
Set connection strategy.
|
void |
setDeltaIncCount(int deltaIncCount)
Set the number of new connections to create once running out the
connection pool.
|
void |
setKeepAliveTimeout(int keepAliveTimeout)
Set the time in milliseconds for abandoning a connection which keep alive time is up.
|
void |
setMaxCount(int maxCount)
Set the capacity of the connection pool.
|
void |
setMaxIdleCount(int maxIdleCount)
Set the maximum number of idle connections.
|
void |
setMinIdleCount(int minIdleCount)
Set the minimum number of idle connections.
|
void |
setNetworkBlockTimeout(int networkBlockTimeout)
Set the network block timeout, which is used to set the send and receive timeout of the connections
inside the connection pool.
|
void |
setPreferredInstance(List<String> preferredInstance)
Set preferred instance for read request in the session.
|
void |
setPreferredInstanceMode(String mode)
Set the mode to choose query instance when multiple preferred instances are found in the session.
|
void |
setSessionTimeout(int timeout)
Set the timeout (in ms) for operations in the session.
|
void |
setSyncCoordInterval(int syncCoordInterval)
Set the interval for updating coord's addresses from catalog in milliseconds.
|
void |
setValidateConnection(boolean validateConnection)
When a idle connection is got out of pool, we need
to validate whether it can be used or not.
|
String |
toString() |
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public int getCacheLimit()
public int getCheckInterval()
public ConnectStrategy getConnectStrategy()
public int getDeltaIncCount()
public int getKeepAliveTimeout()
public int getMaxCount()
public int getMaxIdleCount()
public int getMinIdleCount()
public int getNetworkBlockTimeout()
public List<String> getPreferredInstance()
public String getPreferredInstanceMode()
public int getSessionTimeout()
public int getSyncCoordInterval()
public boolean getValidateConnection()
public void setCacheLimit(int limitBytes)
limitBytes
- The cache size limit of the session in bytes.public void setCheckInterval(int checkInterval)
checkInterval
- CheckInterval should be more than 0, default to be 1 * 60 * 1000ms.BaseException
- If error happens.public void setConnectStrategy(ConnectStrategy strategy)
strategy
- Should one of the follow:
ConnectStrategy.SERIAL,
ConnectStrategy.RANDOM,
ConnectStrategy.LOCAL,
ConnectStrategy.BALANCEpublic void setDeltaIncCount(int deltaIncCount)
deltaIncCount
- DeltaIncCount should be more than 0, default to be 10.BaseException
- If error happens.public void setKeepAliveTimeout(int keepAliveTimeout)
keepAliveTimeout
- KeepAliveTimeout can't be less than 0, default to be 0ms, means not care
about how long does a connection have not be used(send and receive).BaseException
- If error happens.public void setMaxCount(int maxCount)
maxCount
- MaxCount should be can't be less than 0, default to be 500.BaseException
- If error happens.public void setMaxIdleCount(int maxIdleCount)
maxIdleCount
- MaxIdleCount can't be less than 0, default to be 10.BaseException
- If error happens.public void setMinIdleCount(int minIdleCount)
minIdleCount
- MinIdleCount can't be less than 0, default to be 0.BaseException
- If error happens.public void setNetworkBlockTimeout(int networkBlockTimeout)
networkBlockTimeout
- NetworkBlockTimeout can't be less than 0, default to be 6000ms,
0ms and means no timeout.BaseException
- If error happens.public void setPreferredInstance(List<String> preferredInstance)
preferredInstance
- Could be single value in "M", "m", "S", "s", "A", "a", "1"-"255", or
multiple values of them.
BaseException
- If error happens.public void setPreferredInstanceMode(String mode)
mode
- can be one of the follow, default to be "random".
BaseException
- If error happens.public void setSessionTimeout(int timeout)
timeout
- The timeout (in ms) for operations in the session.public void setSyncCoordInterval(int syncCoordInterval)
syncCoordInterval
- SyncCoordInterval can't be less than 0, default to be 0ms.BaseException
- If error happens.public void setValidateConnection(boolean validateConnection)
validateConnection
- Default to be false.Copyright © 2023. All rights reserved.