|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwinstone.jndi.resourceFactories.WinstoneDataSource
public class WinstoneDataSource
Implements a JDBC 2.0 pooling datasource. This is meant to act as a wrapper around a JDBC 1.0 driver, just providing the pool management functions. Supports keep alives, and check-connection-before-get options, as well as normal reclaimable pool management options like maxIdle, maxConnections and startConnections. Additionally it supports poll-retry on full, which means the getConnection call will block and retry after a certain period when the pool is maxed out (good for high load conditions). This class was originally drawn from the generator-runtime servlet framework and modified to make it more JDBC-API only compliant.
Field Summary | |
---|---|
static WinstoneResourceBundle |
DS_RESOURCES
|
Constructor Summary | |
---|---|
WinstoneDataSource(java.lang.String name,
java.util.Map args,
java.lang.ClassLoader loader)
Main constructor. |
Method Summary | ||
---|---|---|
void |
destroy()
Close this pool - probably because we will want to re-init the pool |
|
protected void |
executeKeepAlive(java.sql.Connection connection)
|
|
protected void |
executeKeepAliveOnUnused()
Executes keep alive for each of the connections in the supplied pool |
|
java.sql.Connection |
getConnection()
|
|
protected java.sql.Connection |
getConnection(int retriesAllowed)
Get a read-write connection - preferably from the pool, but fresh if needed |
|
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Gets a connection with a specific username/password. |
|
int |
getLoginTimeout()
|
|
java.io.PrintWriter |
getLogWriter()
|
|
java.util.logging.Logger |
getParentLogger()
|
|
boolean |
isWrapperFor(java.lang.Class<?> iface)
|
|
protected void |
killPooledConnections(java.util.List pool,
int maxIdleCount)
Iterates through a list and kills off unused connections until we reach the minimum idle count for that pool. |
|
protected java.sql.Connection |
makeNewRealConnection(java.util.List pool)
This makes a new rw connection. |
|
void |
run()
Clean up and keep-alive thread. |
|
void |
setLoginTimeout(int timeout)
|
|
void |
setLogWriter(java.io.PrintWriter writer)
|
|
java.lang.String |
toString()
|
|
|
unwrap(java.lang.Class<T> iface)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final WinstoneResourceBundle DS_RESOURCES
Constructor Detail |
---|
public WinstoneDataSource(java.lang.String name, java.util.Map args, java.lang.ClassLoader loader)
Method Detail |
---|
public void destroy()
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
protected java.sql.Connection getConnection(int retriesAllowed) throws java.sql.SQLException
java.sql.SQLException
public int getLoginTimeout()
getLoginTimeout
in interface javax.sql.CommonDataSource
public java.io.PrintWriter getLogWriter()
getLogWriter
in interface javax.sql.CommonDataSource
public void setLoginTimeout(int timeout)
setLoginTimeout
in interface javax.sql.CommonDataSource
public void setLogWriter(java.io.PrintWriter writer)
setLogWriter
in interface javax.sql.CommonDataSource
public void run()
run
in interface java.lang.Runnable
protected void executeKeepAliveOnUnused()
protected void executeKeepAlive(java.sql.Connection connection) throws java.sql.SQLException
java.sql.SQLException
protected java.sql.Connection makeNewRealConnection(java.util.List pool) throws java.sql.SQLException
java.sql.SQLException
protected void killPooledConnections(java.util.List pool, int maxIdleCount)
public java.lang.String toString()
toString
in class java.lang.Object
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
java.sql.SQLException
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
java.sql.SQLException
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
java.sql.SQLFeatureNotSupportedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |