|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsnaq.db.DBPoolDataSource
public class DBPoolDataSource
A DataSource
implementation which produces Connection
instances. This implementation internally references a ConnectionPool
which it uses to provide transparent connection pooling to the client.
Constructor Summary | |
---|---|
DBPoolDataSource()
Creates a new DBPoolDataSource instance. |
Method Summary | ||
---|---|---|
Connection |
getConnection()
Attempts to establish a connection with the database. |
|
Connection |
getConnection(String username,
String password)
Attempts to establish a connection with the database. |
|
String |
getDescription()
Returns the description of this DataSource. |
|
String |
getDriverClassName()
Returns the fully-qualified class name for the JDBC driver to use. |
|
int |
getExpiryTime()
Deprecated. Use getIdleTimeout() instead. |
|
int |
getIdleTimeout()
Returns the idle timeout (seconds) for connections in the underlying ConnectionPool . |
|
int |
getLoginTimeout()
|
|
PrintWriter |
getLogWriter()
Retrieves the log writer for this DataSource. |
|
int |
getMaxPool()
Returns the maximum number of pooled connections in the underlying ConnectionPool . |
|
int |
getMaxSize()
Returns the maximum number of connections in the underlying ConnectionPool . |
|
int |
getMinPool()
Returns the minimum number of pooled connections in the underlying ConnectionPool . |
|
String |
getName()
Returns the JNDI name of the DBPoolDataSource instance. |
|
String |
getPassword()
Returns the password to use with this DataSource. |
|
String |
getPasswordDecoderClassName()
Returns the class name of the PasswordDecoder to use with this DataSource. |
|
String |
getUrl()
Returns the JDBC URL to use with this DataSource. |
|
String |
getUser()
Returns the username to use with this DataSource. |
|
String |
getUsername()
Deprecated. Use getUser() method instead. |
|
String |
getValidationQuery()
Returns the SQL query string to issue for connection validation. |
|
String |
getValidatorClassName()
Returns the class name of the ConnectionValidator to use with this DataSource. |
|
boolean |
isWrapperFor(Class<?> iface)
|
|
void |
maxPoolLimitExceeded(ConnectionPoolEvent evt)
Called when a check-out request causes the maxPool limit to be exceeded. |
|
void |
maxPoolLimitReached(ConnectionPoolEvent evt)
Called when a check-out request causes the maxPool limit to be reached. |
|
void |
maxSizeLimitError(ConnectionPoolEvent evt)
Called when a check-out request attempts to exceed the maxSize limit. |
|
void |
maxSizeLimitReached(ConnectionPoolEvent evt)
Called when a check-out request causes the maxSize limit to be reached. |
|
void |
poolCheckIn(ConnectionPoolEvent evt)
Called when a connection is checked back in to the pool. |
|
void |
poolCheckOut(ConnectionPoolEvent evt)
Called when a connection is checked out of the pool. |
|
void |
poolFlushed(ConnectionPoolEvent evt)
Called when the pool is flushed of free/unused connections. |
|
void |
poolInitCompleted(ConnectionPoolEvent evt)
Called when the pool's ObjectPool.init(int) method has completed. |
|
void |
poolParametersChanged(ConnectionPoolEvent evt)
Called when the pool's parameters are changed. |
|
void |
poolReleased(ConnectionPoolEvent evt)
Called when the pool is released (no more events are fired by the pool after this event). |
|
void |
registerShutdownHook()
Registers a shutdown hook for this ConnectionPoolManager instance to ensure it is released if the JVM exits |
|
void |
release()
Releases the delegate ConnectionPool instance. |
|
void |
releaseAsync()
Asynchronously releases the delegate ConnectionPool instance. |
|
void |
releaseConnectionPool()
Releases (cleans up resources of) the internal ConnectionPool
instance. |
|
void |
releaseForcibly()
Forcibly releases the delegate ConnectionPool instance. |
|
void |
removeShutdownHook()
Deregisters a registered shutdown hook for this ConnectionPoolManager instance. |
|
void |
setDescription(String description)
Sets the description of this DataSource. |
|
void |
setDriverClassName(String driverClassName)
Sets the fully-qualified class name for the JDBC driver to use. |
|
void |
setExpiryTime(int idleTimeout)
Deprecated. Use setIdleTimeout(int) instead. |
|
void |
setIdleTimeout(int idleTimeout)
Sets the idle timeout (seconds) for connections in the underlying ConnectionPool . |
|
void |
setLoginTimeout(int seconds)
Sets the maximum time in seconds that this DataSource will wait while attempting to connect to a database. |
|
void |
setLogWriter(PrintWriter out)
Sets the log writer for this DataSource to the given PrintWriter . |
|
void |
setMaxPool(int maxPool)
Sets the maximum number of pooled connections in the underlying ConnectionPool . |
|
void |
setMaxSize(int maxSize)
Sets the maximum number of connections in the underlying ConnectionPool . |
|
void |
setMinPool(int minPool)
Sets the minimum number of pooled connections in the underlying ConnectionPool . |
|
void |
setName(String name)
Sets the JNDI name of the DBPoolDataSource instance. |
|
void |
setPassword(String password)
Sets the password to use with this DataSource. |
|
void |
setPasswordDecoderClassName(String decoderClassName)
Sets the class name of the PasswordDecoder to use with this
DataSource. |
|
void |
setUrl(String url)
Sets the JDBC URL to use with this DataSource. |
|
void |
setUser(String user)
Sets the username to use with this DataSource. |
|
void |
setUsername(String username)
Deprecated. Use setUser(String) method instead. |
|
void |
setValidationQuery(String validationQuery)
Sets the SQL query string to issue for connection validation. |
|
void |
setValidatorClassName(String validatorClassName)
Sets the class name of the ConnectionValidator to use with this
DataSource. |
|
String |
toString()
|
|
|
unwrap(Class<T> iface)
|
|
void |
validationError(ConnectionPoolEvent evt)
Called when a connection is found to be invalid. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DBPoolDataSource()
DBPoolDataSource
instance.
Method Detail |
---|
public void registerShutdownHook()
public void removeShutdownHook()
public Connection getConnection() throws SQLException
getConnection
in interface DataSource
Connection
instance, or null if unable to connect
SQLException
- if a database access error occurspublic Connection getConnection(String username, String password) throws SQLException
getConnection
in interface DataSource
username
- the database user on whose behalf the connection is being madepassword
- the user's password
Connection
instance, or null if unable to connect
SQLException
- if a database access error occurspublic void releaseConnectionPool()
ConnectionPool
instance. This method should be called to close all the pooled connections.
public String getDescription()
public void setDescription(String description)
public String getUser()
@Deprecated public String getUsername()
getUser()
method instead.
getUser()
.
public void setUser(String user)
@Deprecated public void setUsername(String username)
setUser(String)
method instead.
setUser(String)
.
public String getPassword()
public void setPassword(String password)
public String getName()
DBPoolDataSource
instance.
public void setName(String name)
DBPoolDataSource
instance.
public String getDriverClassName()
public void setDriverClassName(String driverClassName)
public String getPasswordDecoderClassName()
PasswordDecoder
to use with this DataSource.
public void setPasswordDecoderClassName(String decoderClassName)
PasswordDecoder
to use with this
DataSource. The specified class should implement the
PasswordDecoder
interface, and have a no-argument constructor
which can be used to instantiate it for use.
public String getValidatorClassName()
ConnectionValidator
to use with this DataSource.
public void setValidatorClassName(String validatorClassName)
ConnectionValidator
to use with this
DataSource. The specified class should implement the
ConnectionValidator
interface, and have a no-argument constructor
which can be used to instantiate it for use.
public String getValidationQuery()
validationClassName
has not
been explicitly set, in which case this query string is used with an
instance of SimpleQueryValidator
.
public void setValidationQuery(String validationQuery)
validationClassName
has not
been explicitly set, in which case this query string is used with an
instance of SimpleQueryValidator
.
public String getUrl()
public void setUrl(String url)
public int getMinPool()
ConnectionPool
.
public void setMinPool(int minPool)
ConnectionPool
.
public int getMaxPool()
ConnectionPool
.
public void setMaxPool(int maxPool)
ConnectionPool
.
public int getMaxSize()
ConnectionPool
.
public void setMaxSize(int maxSize)
ConnectionPool
.
public int getIdleTimeout()
ConnectionPool
.
public void setIdleTimeout(int idleTimeout)
ConnectionPool
.
@Deprecated public int getExpiryTime()
getIdleTimeout()
instead.
ConnectionPool
.
@Deprecated public void setExpiryTime(int idleTimeout)
setIdleTimeout(int)
instead.
ConnectionPool
.
public PrintWriter getLogWriter()
getLogWriter
in interface CommonDataSource
public void setLogWriter(PrintWriter out)
PrintWriter
.
setLogWriter
in interface CommonDataSource
out
- the new log writer; to disable logging, set to nullpublic void setLoginTimeout(int seconds)
DataSource
object is created, the login timeout is
initially zero.
setLoginTimeout
in interface CommonDataSource
seconds
- the DataSource login time limitpublic int getLoginTimeout()
getLoginTimeout
in interface CommonDataSource
public void release()
ConnectionPool
instance.
public void releaseAsync()
ConnectionPool
instance.
public void releaseForcibly()
ConnectionPool
instance.
public String toString()
toString
in class Object
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public void poolInitCompleted(ConnectionPoolEvent evt)
ConnectionPoolListener
ObjectPool.init(int)
method has completed.
poolInitCompleted
in interface ConnectionPoolListener
public void poolCheckOut(ConnectionPoolEvent evt)
ConnectionPoolListener
poolCheckOut
in interface ConnectionPoolListener
public void poolCheckIn(ConnectionPoolEvent evt)
ConnectionPoolListener
poolCheckIn
in interface ConnectionPoolListener
public void validationError(ConnectionPoolEvent evt)
ConnectionPoolListener
validationError
in interface ConnectionPoolListener
public void maxPoolLimitReached(ConnectionPoolEvent evt)
ConnectionPoolListener
maxPoolLimitReached
in interface ConnectionPoolListener
public void maxPoolLimitExceeded(ConnectionPoolEvent evt)
ConnectionPoolListener
maxPoolLimitExceeded
in interface ConnectionPoolListener
public void maxSizeLimitReached(ConnectionPoolEvent evt)
ConnectionPoolListener
maxSizeLimitReached
in interface ConnectionPoolListener
public void maxSizeLimitError(ConnectionPoolEvent evt)
ConnectionPoolListener
maxSizeLimitError
in interface ConnectionPoolListener
public void poolFlushed(ConnectionPoolEvent evt)
ConnectionPoolListener
poolFlushed
in interface ConnectionPoolListener
public void poolParametersChanged(ConnectionPoolEvent evt)
ConnectionPoolListener
poolParametersChanged
in interface ConnectionPoolListener
public void poolReleased(ConnectionPoolEvent evt)
ConnectionPoolListener
poolReleased
in interface ConnectionPoolListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |