|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openspaces.jdbc.datasource.DbcpBasicDataSource
public class DbcpBasicDataSource
An adaption of BasicDataSource
from jakarta commons dbcp
that uses a space to provide with a pooled data source implementation.
Provides all the different basic data source parameters. Requires an IJSpace
instance.
Field Summary | |
---|---|
protected org.apache.commons.pool.impl.GenericObjectPool |
connectionPool
The object pool that internally manages our connections. |
protected Properties |
connectionProperties
The connection properties that will be sent to our JDBC driver when establishing new connections. |
protected DataSource |
dataSource
The data source we will use to manage connections. |
protected boolean |
defaultAutoCommit
The default auto-commit state of connections created by this pool. |
protected String |
defaultCatalog
The default "catalog" of connections created by this pool. |
protected Boolean |
defaultReadOnly
The default read-only state of connections created by this pool. |
protected int |
defaultTransactionIsolation
The default TransactionIsolation state of connections created by this pool. |
protected int |
initialSize
The initial number of connections that are created when the pool is started. |
protected PrintWriter |
logWriter
The PrintWriter to which log messages should be directed. |
protected int |
maxActive
The maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit. |
protected int |
maxIdle
The maximum number of active connections that can remain idle in the pool, without extra ones being released, or zero for no limit. |
protected int |
maxOpenPreparedStatements
The maximum number of open statements that can be allocated from the statement pool at the same time, or zero for no limit. |
protected long |
maxWait
The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception, or -1 to wait indefinitely. |
protected long |
minEvictableIdleTimeMillis
The minimum amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object evictor (if any). |
protected int |
minIdle
The minimum number of active connections that can remain idle in the pool, without extra ones being created, or 0 to create none. |
protected int |
numTestsPerEvictionRun
The number of objects to examine during each run of the idle object evictor thread (if any). |
protected boolean |
poolPreparedStatements
Prepared statement pooling for this pool. |
protected boolean |
testOnBorrow
The indication of whether objects will be validated before being borrowed from the pool. |
protected boolean |
testOnReturn
The indication of whether objects will be validated before being returned to the pool. |
protected boolean |
testWhileIdle
The indication of whether objects will be validated by the idle object evictor (if any). |
protected long |
timeBetweenEvictionRunsMillis
The number of milliseconds to sleep between runs of the idle object evictor thread. |
protected String |
validationQuery
The SQL query that will be used to validate connections from this pool before returning them to the caller. |
Constructor Summary | |
---|---|
DbcpBasicDataSource()
|
Method Summary | ||
---|---|---|
void |
addConnectionProperty(String name,
String value)
Add a custom connection property to the set that will be passed to our JDBC driver. |
|
void |
afterPropertiesSet()
|
|
void |
close()
Close and release all connections that are currently stored in the connection pool associated with our data source. |
|
protected void |
createDataSource()
Create (if necessary) and return the internal data source we are using to manage our connections. |
|
void |
destroy()
|
|
Connection |
getConnection()
Create (if necessary) and return a connection to the database. |
|
Connection |
getConnection(String username,
String password)
Create (if necessary) and return a connection to the database. |
|
boolean |
getDefaultAutoCommit()
|
|
String |
getDefaultCatalog()
|
|
boolean |
getDefaultReadOnly()
|
|
int |
getDefaultTransactionIsolation()
|
|
int |
getInitialSize()
|
|
boolean |
getLogAbandoned()
Deprecated. |
|
int |
getLoginTimeout()
Return the login timeout (in seconds) for connecting to the database. |
|
PrintWriter |
getLogWriter()
Return the log writer being used by this data source. |
|
int |
getMaxActive()
|
|
int |
getMaxIdle()
|
|
int |
getMaxOpenPreparedStatements()
|
|
long |
getMaxWait()
|
|
long |
getMinEvictableIdleTimeMillis()
|
|
int |
getMinIdle()
|
|
int |
getNumActive()
[Read Only] The current number of active connections that have been allocated from this data source. |
|
int |
getNumIdle()
[Read Only] The current number of idle connections that are waiting to be allocated from this data source. |
|
int |
getNumTestsPerEvictionRun()
|
|
Logger |
getParentLogger()
|
|
boolean |
getRemoveAbandoned()
Deprecated. |
|
int |
getRemoveAbandonedTimeout()
Deprecated. |
|
boolean |
getTestOnBorrow()
|
|
boolean |
getTestOnReturn()
|
|
boolean |
getTestWhileIdle()
|
|
long |
getTimeBetweenEvictionRunsMillis()
|
|
String |
getValidationQuery()
|
|
boolean |
isAccessToUnderlyingConnectionAllowed()
Returns the value of the accessToUnderlyingConnectionAllowed property. |
|
boolean |
isPoolPreparedStatements()
Returns true if we are pooling statements. |
|
boolean |
isWrapperFor(Class<?> iface)
|
|
void |
removeConnectionProperty(String name)
|
|
void |
setAccessToUnderlyingConnectionAllowed(boolean allow)
Sets the value of the accessToUnderlyingConnectionAllowed property. |
|
void |
setDefaultAutoCommit(boolean defaultAutoCommit)
|
|
void |
setDefaultCatalog(String defaultCatalog)
|
|
void |
setDefaultReadOnly(boolean defaultReadOnly)
|
|
void |
setDefaultTransactionIsolation(int defaultTransactionIsolation)
|
|
void |
setGigaSpace(GigaSpace gigaSpace)
|
|
void |
setInitialSize(int initialSize)
|
|
void |
setLogAbandoned(boolean logAbandoned)
Deprecated. |
|
void |
setLoginTimeout(int loginTimeout)
Set the login timeout (in seconds) for connecting to the database. |
|
void |
setLogWriter(PrintWriter logWriter)
Set the log writer being used by this data source. |
|
void |
setMaxActive(int maxActive)
|
|
void |
setMaxIdle(int maxIdle)
|
|
void |
setMaxOpenPreparedStatements(int maxOpenStatements)
|
|
void |
setMaxWait(long maxWait)
|
|
void |
setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
|
|
void |
setMinIdle(int minIdle)
|
|
void |
setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
|
|
void |
setPoolPreparedStatements(boolean poolingStatements)
Sets whether to pool statements or not. |
|
void |
setRemoveAbandoned(boolean removeAbandoned)
Deprecated. |
|
void |
setRemoveAbandonedTimeout(int removeAbandonedTimeout)
Deprecated. |
|
void |
setSpace(IJSpace space)
|
|
void |
setTestOnBorrow(boolean testOnBorrow)
|
|
void |
setTestOnReturn(boolean testOnReturn)
|
|
void |
setTestWhileIdle(boolean testWhileIdle)
|
|
void |
setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
|
|
void |
setValidationQuery(String validationQuery)
|
|
|
unwrap(Class<T> iface)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean defaultAutoCommit
protected Boolean defaultReadOnly
protected int defaultTransactionIsolation
protected String defaultCatalog
protected int maxActive
protected int maxIdle
protected int minIdle
protected int initialSize
protected long maxWait
protected boolean poolPreparedStatements
protected int maxOpenPreparedStatements
protected boolean testOnBorrow
protected boolean testOnReturn
protected long timeBetweenEvictionRunsMillis
protected int numTestsPerEvictionRun
protected long minEvictableIdleTimeMillis
protected boolean testWhileIdle
protected String validationQuery
protected org.apache.commons.pool.impl.GenericObjectPool connectionPool
protected Properties connectionProperties
protected DataSource dataSource
createDataSource()
method.
protected PrintWriter logWriter
Constructor Detail |
---|
public DbcpBasicDataSource()
Method Detail |
---|
public void setSpace(IJSpace space)
public void setGigaSpace(GigaSpace gigaSpace)
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
public boolean getDefaultAutoCommit()
public void setDefaultAutoCommit(boolean defaultAutoCommit)
public boolean getDefaultReadOnly()
public void setDefaultReadOnly(boolean defaultReadOnly)
public int getDefaultTransactionIsolation()
public void setDefaultTransactionIsolation(int defaultTransactionIsolation)
public String getDefaultCatalog()
public void setDefaultCatalog(String defaultCatalog)
public int getMaxActive()
public void setMaxActive(int maxActive)
public int getMaxIdle()
public void setMaxIdle(int maxIdle)
public int getMinIdle()
public void setMinIdle(int minIdle)
public int getInitialSize()
public void setInitialSize(int initialSize)
public long getMaxWait()
public void setMaxWait(long maxWait)
public boolean isPoolPreparedStatements()
public void setPoolPreparedStatements(boolean poolingStatements)
poolingStatements
- pooling on or offpublic int getMaxOpenPreparedStatements()
public void setMaxOpenPreparedStatements(int maxOpenStatements)
public boolean getTestOnBorrow()
public void setTestOnBorrow(boolean testOnBorrow)
public boolean getTestOnReturn()
public void setTestOnReturn(boolean testOnReturn)
public long getTimeBetweenEvictionRunsMillis()
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
public int getNumTestsPerEvictionRun()
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
public long getMinEvictableIdleTimeMillis()
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
public boolean getTestWhileIdle()
public void setTestWhileIdle(boolean testWhileIdle)
public int getNumActive()
public int getNumIdle()
public String getValidationQuery()
public void setValidationQuery(String validationQuery)
public boolean isAccessToUnderlyingConnectionAllowed()
public void setAccessToUnderlyingConnectionAllowed(boolean allow)
allow
- Access to the underlying connection is granted when true.public Connection getConnection() throws SQLException
getConnection
in interface DataSource
SQLException
- if a database access error occurspublic Connection getConnection(String username, String password) throws SQLException
getConnection
in interface DataSource
username
- Database user on whose behalf the Connection
is being madepassword
- The database user's password
SQLException
- if a database access error occurspublic int getLoginTimeout() throws SQLException
getLoginTimeout
in interface CommonDataSource
SQLException
- if a database access error occurspublic PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface CommonDataSource
SQLException
- if a database access error occurspublic void setLoginTimeout(int loginTimeout) throws SQLException
setLoginTimeout
in interface CommonDataSource
loginTimeout
- The new login timeout, or zero for no timeout
SQLException
- if a database access error occurspublic void setLogWriter(PrintWriter logWriter) throws SQLException
setLogWriter
in interface CommonDataSource
logWriter
- The new log writer
SQLException
- if a database access error occurs@Deprecated public boolean getRemoveAbandoned()
@Deprecated public void setRemoveAbandoned(boolean removeAbandoned)
removeAbandoned
- @Deprecated public int getRemoveAbandonedTimeout()
@Deprecated public void setRemoveAbandonedTimeout(int removeAbandonedTimeout)
removeAbandonedTimeout
- @Deprecated public boolean getLogAbandoned()
@Deprecated public void setLogAbandoned(boolean logAbandoned)
logAbandoned
- public void addConnectionProperty(String name, String value)
name
- Name of the custom connection propertyvalue
- Value of the custom connection propertypublic void removeConnectionProperty(String name)
public void close() throws SQLException
SQLException
- if a database error occursprotected void createDataSource() throws SQLException
Create (if necessary) and return the internal data source we are using to manage our connections.
IMPLEMENTATION NOTE - It is tempting to use the "double checked locking" idiom in an attempt to avoid synchronizing on every single call to this method. However, this idiom fails to work correctly in the face of some optimizations that are legal for a JVM to perform.
SQLException
- if the object pool cannot be created.public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public Logger getParentLogger() throws SQLFeatureNotSupportedException
SQLFeatureNotSupportedException
|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |