|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PoolConfiguration
A list of properties that are configurable for a connection pool.
| Method Summary | |
|---|---|
Object |
get(String name)
Provides a generic getter for any of the declared properties of the PoolConfiguration |
int |
getAbandonWhenPercentageFull()
Connections that have been abandoned (timed out) wont get closed and reported up unless the number of connections in use are above the percentage defined by abandonWhenPercentageFull. |
String[] |
getConfiguredHosts()
Returns an array of configured hosts (may be different from the actual list if dynamic discovery is enabled) |
Object |
getDataSource()
Returns a datasource, if one exists that is being used to create connections. |
String |
getDataSourceJNDI()
Returns the JNDI string configured for data source usage. |
HostFailoverPolicy |
getFailoverPolicy()
Returns the failover policy. |
String |
getHost()
Returns the Cassandra hosts |
long |
getHostRetryInterval()
Returns the interval in milliseconds before retrying a host to which a connection has failed in the past. |
int |
getInitialSize()
Returns the number of connections that will be established when the connection pool is started. |
String |
getKeySpace()
Returns the keyspace |
int |
getMaxActive()
The maximum number of active connections that can be allocated from this pool at the same time. |
long |
getMaxAge()
Time in milliseconds to keep this connection alive even when used. |
int |
getMaxIdle()
The maximum number of connections that should be kept in the idle pool if isPoolSweeperEnabled() returns false. |
int |
getMaxWait()
The maximum number of milliseconds that the pool will wait (when there are no available connections and the getMaxActive() has been reached) for a connection to be returned
before throwing an exception. |
int |
getMinEvictableIdleTimeMillis()
The minimum amount of time an object must sit idle in the pool before it is eligible for eviction. |
int |
getMinIdle()
The minimum number of established connections that should be kept in the pool at all times. |
String |
getName()
Returns the name of the connection pool. |
int |
getNumTestsPerEvictionRun()
Property not used |
String |
getPassword()
Returns the password used when establishing connections to the database. |
String |
getPoolName()
|
int |
getPort()
Returns the Cassandra port (defaults to 9160) |
int |
getRemoveAbandonedTimeout()
The time in seconds before a connection can be considered abandoned. |
int |
getSocketTimeout()
Returns the socket timeout in milliseconds |
int |
getSuspectTimeout()
Returns the time in seconds to pass before a connection is marked an abanoned suspect. |
int |
getTimeBetweenEvictionRunsMillis()
The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner and idle pool resizing. |
String |
getUrl()
Returns the Cassandra connection URL |
boolean |
getUseLock()
Return true if a lock should be used when operations are performed on the connection object. |
String |
getUsername()
Returns the username used to establish the connection with |
long |
getValidationInterval()
avoid excess validation, only run validation at most at this frequency - time in milliseconds. |
boolean |
isAutomaticHostDiscovery()
Returns whether automatic host discovery is being used |
boolean |
isFairQueue()
Returns true if a fair queue is being used by the connection pool |
boolean |
isFramed()
Returns whether framed connection mode is being used |
boolean |
isJmxEnabled()
If set to true, the connection pool creates a ConnectionPoolMBean object
that can be registered with JMX to receive notifications and state about the pool. |
boolean |
isLogAbandoned()
boolean flag to set if stack traces should be logged for application code which abandoned a Connection. |
boolean |
isPoolSweeperEnabled()
Returns true if the pool sweeper is enabled for the connection pool. |
boolean |
isRemoveAbandoned()
boolean flag to remove abandoned connections if they exceed the removeAbandonedTimout. |
boolean |
isTestOnBorrow()
The indication of whether objects will be validated before being borrowed from the pool. |
boolean |
isTestOnConnect()
Returns true if we should run the validation query when connecting to the database for the first time on a connection. |
boolean |
isTestOnReturn()
The indication of whether objects will be validated after being returned to the pool. |
boolean |
isTestWhileIdle()
Set to true if query validation should take place while the connection is idle. |
boolean |
isUseEquals()
Set to true if you wish the ProxyConnection class to use String.equals instead of
== when comparing method names. |
void |
set(String name,
Object value)
Provides a generic setter for any of the declared properties of the PoolConfiguration |
void |
setAbandonWhenPercentageFull(int percentage)
Connections that have been abandoned (timed out) wont get closed and reported up unless the number of connections in use are above the percentage defined by abandonWhenPercentageFull. |
void |
setAutomaticHostDiscovery(boolean autoDiscovery)
Sets whether Cassandra hosts should be queried to automatically obtain a list of other hosts |
void |
setDataSource(Object ds)
Injects a datasource that will be used to retrieve/create connections. |
void |
setDataSourceJNDI(String jndiDS)
Configure the connection pool to use a DataSource according to setDataSource(Object)
But instead of injecting the object, specify the JNDI location. |
void |
setFailoverPolicy(HostFailoverPolicy failoverPolicy)
Sets the host failover policy, i.e. what to do when connecting to a host fails |
void |
setFairQueue(boolean fairQueue)
Set to true if you wish that calls to getConnection should be treated fairly in a true FIFO fashion. |
void |
setFramed(boolean framed)
Sets whether to use framed connection mode (default false) |
void |
setHost(String host)
Sets the Cassandra host. |
void |
setHostRetryInterval(long hostRetryInterval)
Sets the interval in milliseconds before retrying a host to which a connection has failed in the past. |
void |
setInitialSize(int initialSize)
Set the number of connections that will be established when the connection pool is started. |
void |
setJmxEnabled(boolean jmxEnabled)
If set to true, the connection pool creates a ConnectionPoolMBean object
that can be registered with JMX to receive notifications and state about the pool. |
void |
setKeySpace(String keySpace)
Sets the keyspace |
void |
setLogAbandoned(boolean logAbandoned)
boolean flag to set if stack traces should be logged for application code which abandoned a Connection. |
void |
setMaxActive(int maxActive)
The maximum number of active connections that can be allocated from this pool at the same time. |
void |
setMaxAge(long maxAge)
Time in milliseconds to keep this connection alive even when used. |
void |
setMaxIdle(int maxIdle)
The maximum number of connections that should be kept in the idle pool if isPoolSweeperEnabled() returns false. |
void |
setMaxWait(int maxWait)
The maximum number of milliseconds that the pool will wait (when there are no available connections and the getMaxActive() has been reached) for a connection to be returned
before throwing an exception. |
void |
setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
The minimum amount of time an object must sit idle in the pool before it is eligible for eviction. |
void |
setMinIdle(int minIdle)
The minimum number of established connections that should be kept in the pool at all times. |
void |
setName(String name)
Sets the name of the connection pool |
void |
setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
Property not used |
void |
setPassword(String password)
Sets the password to establish the connection with. |
void |
setPort(int port)
Sets the Cassandra port |
void |
setRemoveAbandoned(boolean removeAbandoned)
boolean flag to remove abandoned connections if they exceed the removeAbandonedTimout. |
void |
setRemoveAbandonedTimeout(int removeAbandonedTimeout)
The time in seconds before a connection can be considered abandoned. |
void |
setSocketTimeout(int socketTimeout)
Sets the socket timeout in milliseconds |
void |
setSuspectTimeout(int seconds)
Similar to setRemoveAbandonedTimeout(int) but instead of treating the connection
as abandoned, and potentially closing the connection, this simply logs the warning if
isLogAbandoned() returns true. |
void |
setTestOnBorrow(boolean testOnBorrow)
The indication of whether objects will be validated before being borrowed from the pool. |
void |
setTestOnConnect(boolean testOnConnect)
Set to true if we should run the validation query when connecting to the database for the first time on a connection. |
void |
setTestOnReturn(boolean testOnReturn)
The indication of whether objects will be validated after being returned to the pool. |
void |
setTestWhileIdle(boolean testWhileIdle)
Set to true if query validation should take place while the connection is idle. |
void |
setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner and idle pool resizing. |
void |
setUrl(String url)
Sets the Cassandra connection URL. |
void |
setUseEquals(boolean useEquals)
Set to true if you wish the ProxyConnection class to use String.equals instead of
== when comparing method names. |
void |
setUseLock(boolean useLock)
Set to true if a lock should be used when operations are performed on the connection object. |
void |
setUsername(String username)
Sets the username used to establish the connection with |
void |
setValidationInterval(long validationInterval)
avoid excess validation, only run validation at most at this frequency - time in milliseconds. |
| Method Detail |
|---|
void set(String name,
Object value)
name - the name of the propertyvalue - the new value of the propertyObject get(String name)
name - the name of the property
void setHost(String host)
host - String getHost()
void setUrl(String url)
url - String getUrl()
void setPort(int port)
port - int getPort()
void setFramed(boolean framed)
framed - boolean isFramed()
void setAutomaticHostDiscovery(boolean autoDiscovery)
autoDiscovery - boolean isAutomaticHostDiscovery()
void setFailoverPolicy(HostFailoverPolicy failoverPolicy)
HostFailoverPolicy getFailoverPolicy()
void setAbandonWhenPercentageFull(int percentage)
percentage - a value between 0 and 100 to indicate when connections that have been abandoned/timed out are considered abandonedint getAbandonWhenPercentageFull()
boolean isFairQueue()
void setFairQueue(boolean fairQueue)
FairBlockingQueue implementation for the list of the idle connections.
The default value is true.
This flag is required when you want to use asynchronous connection retrieval.
fairQueue - int getInitialSize()
void setInitialSize(int initialSize)
setMaxActive(int) it will automatically be lowered.
initialSize - the number of connections to be established.boolean isLogAbandoned()
void setLogAbandoned(boolean logAbandoned)
logAbandoned - set to true if stack traces should be recorded when DataSourceProxy.getConnection() is called.int getMaxActive()
void setMaxActive(int maxActive)
maxActive - hard limit for number of managed connections by this poolint getMaxIdle()
isPoolSweeperEnabled() returns false.
If the If isPoolSweeperEnabled() returns true, then the idle pool can grow up to getMaxActive()
and will be shrunk according to getMinEvictableIdleTimeMillis() setting.
Default value is maxActive:100
void setMaxIdle(int maxIdle)
isPoolSweeperEnabled() returns false.
If the If isPoolSweeperEnabled() returns true, then the idle pool can grow up to getMaxActive()
and will be shrunk according to getMinEvictableIdleTimeMillis() setting.
Default value is maxActive:100
maxIdle - the maximum size of the idle poolint getMaxWait()
getMaxActive() has been reached) for a connection to be returned
before throwing an exception. Default value is 30000 (30 seconds)
void setMaxWait(int maxWait)
getMaxActive() has been reached) for a connection to be returned
before throwing an exception. Default value is 30000 (30 seconds)
maxWait - the maximum number of milliseconds to wait.int getMinEvictableIdleTimeMillis()
void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
minEvictableIdleTimeMillis - the number of milliseconds a connection must be idle to be eligible for eviction.int getMinIdle()
getInitialSize() (also see setTestWhileIdle(boolean)
The idle pool will not shrink below this value during an eviction run, hence the number of actual connections
can be between getMinIdle() and somewhere between getMaxIdle() and getMaxActive()
void setMinIdle(int minIdle)
getInitialSize() (also see setTestWhileIdle(boolean)
The idle pool will not shrink below this value during an eviction run, hence the number of actual connections
can be between getMinIdle() and somewhere between getMaxIdle() and getMaxActive()
minIdle - the minimum number of idle or established connectionsString getName()
void setName(String name)
name - the name of the pool, should be unique in a runtime JVMint getNumTestsPerEvictionRun()
void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
numTestsPerEvictionRun - parameter ignored.String getPassword()
void setPassword(String password)
password - String getPoolName()
getName()String getKeySpace()
void setKeySpace(String keySpace)
keySpace - String getUsername()
void setUsername(String username)
username - boolean isRemoveAbandoned()
getRemoveAbandonedTimeout() and the condition for
getAbandonWhenPercentageFull() is met.
Setting this to true can recover db connections from applications that fail to close a connection.
See also isLogAbandoned() The default value is false.
void setRemoveAbandoned(boolean removeAbandoned)
getRemoveAbandonedTimeout() and the condition for
getAbandonWhenPercentageFull() is met.
Setting this to true can recover db connections from applications that fail to close a connection.
See also isLogAbandoned() The default value is false.
removeAbandoned - set to true if abandoned connections can be closed and expelled out of the poolvoid setRemoveAbandonedTimeout(int removeAbandonedTimeout)
removeAbandonedTimeout - the time in seconds before a used connection can be considered abandoned *int getRemoveAbandonedTimeout()
boolean isTestOnBorrow()
setValidationInterval(long)
getValidationInterval()void setTestOnBorrow(boolean testOnBorrow)
setValidationInterval(long)
testOnBorrow - set to true if validation should take place before a connection is handed out to the applicationgetValidationInterval()boolean isTestOnReturn()
setValidationInterval(long)
getValidationInterval()void setTestOnReturn(boolean testOnReturn)
setValidationInterval(long)
testOnReturn - true if validation should take place after a connection is returned to the poolgetValidationInterval()boolean isTestWhileIdle()
setTimeBetweenEvictionRunsMillis(int)void setTestWhileIdle(boolean testWhileIdle)
testWhileIdle - true if validation should take place during idle checkssetTimeBetweenEvictionRunsMillis(int)int getTimeBetweenEvictionRunsMillis()
void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
timeBetweenEvictionRunsMillis - the sleep time in between validations in millisecondslong getValidationInterval()
void setValidationInterval(long validationInterval)
validationInterval - the validation interval in millisecondsboolean isTestOnConnect()
void setTestOnConnect(boolean testOnConnect)
testOnConnect - set to true if we should run the validation query upon connectboolean isJmxEnabled()
ConnectionPoolMBean object
that can be registered with JMX to receive notifications and state about the pool.
The ConnectionPool object doesn't register itself, as there is no way to keep a static non changing ObjectName across JVM restarts.
void setJmxEnabled(boolean jmxEnabled)
ConnectionPoolMBean object
that can be registered with JMX to receive notifications and state about the pool.
The ConnectionPool object doesn't register itself, as there is no way to keep a static non changing ObjectName across JVM restarts.
jmxEnabled - set to to if the mbean object should be created upon startup.boolean isPoolSweeperEnabled()
boolean isUseEquals()
ProxyConnection class to use String.equals instead of
== when comparing method names.
This property does not apply to added interceptors as those are configured individually.
The default value is false.
String.equals(Object) instead of == when comparing method names on Connection methodsvoid setUseEquals(boolean useEquals)
ProxyConnection class to use String.equals instead of
== when comparing method names.
This property does not apply to added interceptors as those are configured individually.
The default value is false.
useEquals - set to true if the pool should use String.equals(Object) instead of ==
when comparing method names on Connection methodslong getMaxAge()
void setMaxAge(long maxAge)
maxAge - the time in milliseconds a connection will be open for when usedboolean getUseLock()
void setUseLock(boolean useLock)
useLock - set to true if a lock should be used on connection operationsvoid setSuspectTimeout(int seconds)
setRemoveAbandonedTimeout(int) but instead of treating the connection
as abandoned, and potentially closing the connection, this simply logs the warning if
isLogAbandoned() returns true. If this value is equal or less than 0, no suspect
checking will be performed. Suspect checking only takes place if the timeout value is larger than 0 and
the connection was not abandoned or if abandon check is disabled. If a connection is suspect a WARN message gets
logged and a JMX notification gets sent once.
seconds - - the amount of time in seconds that has to pass before a connection is marked suspect.int getSuspectTimeout()
int getSocketTimeout()
void setSocketTimeout(int socketTimeout)
socketTimeout - String[] getConfiguredHosts()
long getHostRetryInterval()
void setHostRetryInterval(long hostRetryInterval)
hostRetryInterval - number of millieseconds before retrying a hostvoid setDataSourceJNDI(String jndiDS)
setDataSource(Object)
But instead of injecting the object, specify the JNDI location.
After a successful JNDI look, the getDataSource() will not return null.
jndiDS - -the JNDI string @TODO specify the rules here.String getDataSourceJNDI()
void setDataSource(Object ds)
ds - the DataSource to be used for creating connections to be pooled.Object getDataSource()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||