You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jm...@apache.org on 2002/03/04 08:50:15 UTC
cvs commit: jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter PoolablePreparedStatementStub.java DriverAdapterCPDS.java PooledConnectionImpl.java
jmcnally 02/03/03 23:50:15
Modified: jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter
DriverAdapterCPDS.java PooledConnectionImpl.java
Added: jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter
PoolablePreparedStatementStub.java
Log:
added PreparedStatement pooling. Not tested.
Revision Changes Path
1.3 +251 -84 jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter/DriverAdapterCPDS.java
Index: DriverAdapterCPDS.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter/DriverAdapterCPDS.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DriverAdapterCPDS.java 17 Jan 2002 05:44:26 -0000 1.2
+++ DriverAdapterCPDS.java 4 Mar 2002 07:50:15 -0000 1.3
@@ -73,33 +73,24 @@
import javax.naming.StringRefAddr;
import javax.naming.NamingException;
+import org.apache.commons.pool.KeyedObjectPool;
+import org.apache.commons.pool.impl.GenericKeyedObjectPool;
+
/**
* An adapter for jdbc drivers that do not include an implementation
* of ConnectionPoolDataSource. This DataSource uses the old
* DriverManager implementation
*
* @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
- * @version $Id: DriverAdapterCPDS.java,v 1.2 2002/01/17 05:44:26 jmcnally Exp $
+ * @version $Id: DriverAdapterCPDS.java,v 1.3 2002/03/04 07:50:15 jmcnally Exp $
*/
public class DriverAdapterCPDS
implements ConnectionPoolDataSource, Referenceable, Serializable,
ObjectFactory
{
- /** Description */
- private String description;
- /** Password */
- private String password;
- /** Url name */
- private String url;
- /** User name */
- private String user;
- /** Driver class name */
- private String driver;
-
- /** Login TimeOut in seconds */
- private int loginTimeout;
- /** Log stream */
- private PrintWriter logWriter = null;
+ private static final String GET_CONNECTION_CALLED =
+ "A PooledConnection was already requested from this source, " +
+ "further initialization is not allowed.";
/**
* Default no-arg constructor for Serialization
@@ -108,6 +99,113 @@
{
}
+ /**
+ * Attempt to establish a database connection using the default
+ * user and password.
+ */
+ public PooledConnection getPooledConnection()
+ throws SQLException
+ {
+ return getPooledConnection(getUser(), getPassword());
+ }
+
+ /**
+ * Attempt to establish a database connection.
+ */
+ public PooledConnection getPooledConnection(String username,
+ String password)
+ throws SQLException
+ {
+ getConnectionCalled = true;
+ /*
+ public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory,
+ int maxActive, byte whenExhaustedAction, long maxWait,
+ int maxIdle, boolean testOnBorrow, boolean testOnReturn,
+ long timeBetweenEvictionRunsMillis,
+ int numTestsPerEvictionRun, long minEvictableIdleTimeMillis,
+ boolean testWhileIdle) {
+ */
+ KeyedObjectPool stmtPool = new GenericKeyedObjectPool(null,
+ getMaxActive(), GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 0,
+ getMaxIdle(), false, false, getTimeBetweenEvictionRunsMillis(),
+ getNumTestsPerEvictionRun(),
+ getMinEvictableIdleTimeMillis(), false);
+
+ // Workaround for buggy WebLogic 5.1 classloader - ignore the
+ // exception upon first invocation.
+ try
+ {
+ return new PooledConnectionImpl(
+ DriverManager.getConnection( getUrl(),
+ username,
+ password ), stmtPool );
+ }
+ catch( ClassCircularityError e )
+ {
+ return new PooledConnectionImpl(
+ DriverManager.getConnection( getUrl(),
+ username,
+ password ), stmtPool );
+ }
+ }
+
+
+ /**
+ * <CODE>Referenceable</CODE> implementation.
+ */
+ public Reference getReference()
+ throws NamingException
+ {
+ String factory = getClass().getName();
+
+ Reference ref = new Reference(getClass().getName(), factory, null);
+
+ ref.add(new StringRefAddr("description", getDescription()));
+ ref.add(new StringRefAddr("password", getPassword()));
+ ref.add(new StringRefAddr("user", getUser()));
+ ref.add(new StringRefAddr("url", getUrl()));
+
+ return ref;
+ }
+
+
+ /**
+ * implements ObjectFactory to create an instance of this class
+ */
+ public Object getObjectInstance(Object refObj, Name name,
+ Context context, Hashtable env)
+ throws Exception
+ {
+ Reference ref = (Reference)refObj;
+
+ if (ref.getClassName().equals(getClass().getName()))
+ {
+ setDescription((String)ref.get("description").getContent());
+ setUrl((String)ref.get("url").getContent());
+ setUser((String)ref.get("user").getContent());
+ setPassword((String)ref.get("password").getContent());
+ return this;
+ }
+ else
+ {
+ // We can't create an instance of the reference
+ return null;
+ }
+ }
+
+ /**
+ * Throws an IllegalStateException, if a PooledConnection has already
+ * been requested.
+ */
+ private void assertInitializationAllowed()
+ throws IllegalStateException
+ {
+ if (getConnectionCalled)
+ {
+ throw new IllegalStateException(GET_CONNECTION_CALLED);
+ }
+ }
+
// Properties
/**
@@ -149,6 +247,7 @@
*/
public void setPassword(String v)
{
+ assertInitializationAllowed();
this.password = v;
}
@@ -167,6 +266,7 @@
*/
public void setUrl(String v)
{
+ assertInitializationAllowed();
this.url = v;
}
@@ -185,6 +285,7 @@
*/
public void setUser(String v)
{
+ assertInitializationAllowed();
this.user = v;
}
@@ -205,47 +306,13 @@
public void setDriver(String v)
throws ClassNotFoundException
{
+ assertInitializationAllowed();
this.driver = v;
// make sure driver is registered
Class.forName(v);
}
/**
- * Attempt to establish a database connection using the default
- * user and password.
- */
- public PooledConnection getPooledConnection()
- throws SQLException
- {
- return getPooledConnection(getUser(), getPassword());
- }
-
- /**
- * Attempt to establish a database connection.
- */
- public PooledConnection getPooledConnection(String username,
- String password)
- throws SQLException
- {
- // Workaround for buggy WebLogic 5.1 classloader - ignore the
- // exception upon first invocation.
- try
- {
- return new PooledConnectionImpl(
- DriverManager.getConnection( getUrl(),
- getUser(),
- getPassword() ) );
- }
- catch( ClassCircularityError e )
- {
- return new PooledConnectionImpl(
- DriverManager.getConnection( getUrl(),
- getUser(),
- getPassword() ) );
- }
- }
-
- /**
* Gets the maximum time in seconds that this data source can wait
* while attempting to connect to a database. NOT USED.
*/
@@ -279,47 +346,147 @@
logWriter = out;
}
+
+ // ------------------------------------------------------------------
+ // PreparedStatement pool properties
+
/**
- * <CODE>Referenceable</CODE> implementation.
+ * The maximum number of active statements that can be allocated from
+ * this pool at the same time, or zero for no limit.
*/
- public Reference getReference()
- throws NamingException
- {
- String factory = getClass().getName();
-
- Reference ref = new Reference(getClass().getName(), factory, null);
+ public int getMaxActive() {
+ return (this.maxActive);
+ }
- ref.add(new StringRefAddr("description", getDescription()));
- ref.add(new StringRefAddr("password", getPassword()));
- ref.add(new StringRefAddr("user", getUser()));
- ref.add(new StringRefAddr("url", getUrl()));
+ /**
+ * The maximum number of active statements that can be allocated from
+ * this pool at the same time, or zero for no limit.
+ */
+ public void setMaxActive(int maxActive) {
+ assertInitializationAllowed();
+ this.maxActive = maxActive;
+ }
- return ref;
+ /**
+ * The maximum number of active statements that can remain idle in the
+ * pool, without extra ones being released, or zero for no limit.
+ */
+ public int getMaxIdle() {
+ return (this.maxIdle);
}
+ /**
+ * The maximum number of active statements that can remain idle in the
+ * pool, without extra ones being released, or zero for no limit.
+ */
+ public void setMaxIdle(int maxIdle) {
+ assertInitializationAllowed();
+ this.maxIdle = maxIdle;
+ }
/**
- * implements ObjectFactory to create an instance of this class
- */
- public Object getObjectInstance(Object refObj, Name name,
- Context context, Hashtable env)
- throws Exception
- {
- Reference ref = (Reference)refObj;
-
- if (ref.getClassName().equals(getClass().getName()))
- {
- setDescription((String)ref.get("description").getContent());
- setUrl((String)ref.get("url").getContent());
- setUser((String)ref.get("user").getContent());
- setPassword((String)ref.get("password").getContent());
- return this;
- }
- else
- {
- // We can't create an instance of the reference
- return null;
- }
+ * Returns the number of milliseconds to sleep between runs of the
+ * idle object evictor thread.
+ * When non-positive, no idle object evictor thread will be
+ * run.
+ *
+ * *see #setTimeBetweenEvictionRunsMillis
+ */
+ public synchronized long getTimeBetweenEvictionRunsMillis() {
+ return _timeBetweenEvictionRunsMillis;
+ }
+
+ /**
+ * Sets the number of milliseconds to sleep between runs of the
+ * idle object evictor thread.
+ * When non-positive, no idle object evictor thread will be
+ * run.
+ *
+ * *see #getTimeBetweenEvictionRunsMillis
+ */
+ public synchronized void
+ setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) {
+ assertInitializationAllowed();
+ _timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
+ }
+
+ /**
+ * Returns the number of objects to examine during each run of the
+ * idle object evictor thread (if any).
+ *
+ * *see #setNumTestsPerEvictionRun
+ * *see #setTimeBetweenEvictionRunsMillis
+ */
+ public int getNumTestsPerEvictionRun() {
+ return _numTestsPerEvictionRun;
+ }
+
+ /**
+ * Sets the number of objects to examine during each run of the
+ * idle object evictor thread (if any).
+ * <p>
+ * When a negative value is supplied, <tt>ceil({*link #numIdle})/abs({*link #getNumTestsPerEvictionRun})</tt>
+ * tests will be run. I.e., when the value is <i>-n</i>, roughly one <i>n</i>th of the
+ * idle objects will be tested per run.
+ *
+ * *see #getNumTestsPerEvictionRun
+ * *see #setTimeBetweenEvictionRunsMillis
+ */
+ public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) {
+ assertInitializationAllowed();
+ _numTestsPerEvictionRun = numTestsPerEvictionRun;
}
+ /**
+ * Returns the minimum amount of time an object may sit idle in the pool
+ * before it is eligable for eviction by the idle object evictor
+ * (if any).
+ *
+ * *see #setMinEvictableIdleTimeMillis
+ * *see #setTimeBetweenEvictionRunsMillis
+ */
+ public synchronized int getMinEvictableIdleTimeMillis() {
+ return _minEvictableIdleTimeMillis;
+ }
+
+ /**
+ * Sets the minimum amount of time an object may sit idle in the pool
+ * before it is eligable for eviction by the idle object evictor
+ * (if any).
+ * When non-positive, no objects will be evicted from the pool
+ * due to idle time alone.
+ *
+ * *see #getMinEvictableIdleTimeMillis
+ * *see #setTimeBetweenEvictionRunsMillis
+ */
+ public synchronized void
+ setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) {
+ assertInitializationAllowed();
+ _minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
+ }
+
+ /** Description */
+ private String description;
+ /** Password */
+ private String password;
+ /** Url name */
+ private String url;
+ /** User name */
+ private String user;
+ /** Driver class name */
+ private String driver;
+
+ /** Login TimeOut in seconds */
+ private int loginTimeout;
+ /** Log stream */
+ private PrintWriter logWriter = null;
+
+ // PreparedStatement pool properties
+ private int maxActive = 10;
+ private int maxIdle = 10;
+ private long _timeBetweenEvictionRunsMillis = -1L;
+ private int _numTestsPerEvictionRun = -1;
+ private int _minEvictableIdleTimeMillis = -1;
+
+ private boolean getConnectionCalled = false;
}
1.3 +226 -3 jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter/PooledConnectionImpl.java
Index: PooledConnectionImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter/PooledConnectionImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PooledConnectionImpl.java 17 Jan 2002 05:44:26 -0000 1.2
+++ PooledConnectionImpl.java 4 Mar 2002 07:50:15 -0000 1.3
@@ -69,15 +69,19 @@
import javax.sql.ConnectionEventListener;
import javax.sql.PooledConnection;
+import org.apache.commons.dbcp.*;
+import org.apache.commons.pool.KeyedObjectPool;
+import org.apache.commons.pool.KeyedPoolableObjectFactory;
+
/**
* Implementation of PooledConnection that is returned by
* PooledConnectionDataSource.
*
* @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
- * @version $Id: PooledConnectionImpl.java,v 1.2 2002/01/17 05:44:26 jmcnally Exp $
+ * @version $Id: PooledConnectionImpl.java,v 1.3 2002/03/04 07:50:15 jmcnally Exp $
*/
public class PooledConnectionImpl
- implements PooledConnection
+ implements PooledConnection, KeyedPoolableObjectFactory
{
private static final String CLOSED =
"Attempted to use PooledConnection after closed() was called.";
@@ -102,14 +106,20 @@
*/
boolean isClosed;
+ /** My pool of {*link PreparedStatement}s. */
+ protected KeyedObjectPool _pstmtPool = null;
+
+
/**
* Wrap the real connection.
*/
- PooledConnectionImpl(Connection connection)
+ PooledConnectionImpl(Connection connection, KeyedObjectPool pool)
{
this.connection = connection;
eventListeners = new Vector();
isClosed = false;
+ _pstmtPool = pool;
+ _pstmtPool.setFactory(this);
}
/**
@@ -134,6 +144,10 @@
throws SQLException
{
isClosed = true;
+ if(null != _pstmtPool) {
+ _pstmtPool.close();
+ _pstmtPool = null;
+ }
connection.close();
}
@@ -215,6 +229,215 @@
while ( i.hasNext() )
{
((ConnectionEventListener)i.next()).connectionClosed(event);
+ }
+ }
+
+ // -------------------------------------------------------------------
+ // The following code implements a PreparedStatement pool
+
+ /**
+ * Create or obtain a {*link PreparedStatement} from my pool.
+ * @return a {*link PoolablePreparedStatement}
+ */
+ public PreparedStatement prepareStatement(String sql)
+ throws SQLException {
+ try {
+ return(PreparedStatement)(_pstmtPool.borrowObject(createKey(sql)));
+ } catch(RuntimeException e) {
+ throw e;
+ } catch(Exception e) {
+ throw new SQLException(e.toString());
+ }
+ }
+
+ /**
+ * Create or obtain a {*link PreparedStatement} from my pool.
+ * @return a {*link PoolablePreparedStatement}
+ */
+ public PreparedStatement prepareStatement(String sql, int resultSetType,
+ int resultSetConcurrency)
+ throws SQLException {
+ try {
+ return(PreparedStatement)(_pstmtPool.borrowObject(
+ createKey(sql,resultSetType,resultSetConcurrency)));
+ } catch(RuntimeException e) {
+ throw e;
+ } catch(Exception e) {
+ throw new SQLException(e.toString());
+ }
+ }
+
+ /**
+ * Create a {*link PoolingConnection.PStmtKey} for the given arguments.
+ */
+ protected Object createKey(String sql, int resultSetType,
+ int resultSetConcurrency) {
+ return new PStmtKey(normalizeSQL(sql), resultSetType,
+ resultSetConcurrency);
+ }
+
+ /**
+ * Create a {*link PoolingConnection.PStmtKey} for the given arguments.
+ */
+ protected Object createKey(String sql) {
+ return new PStmtKey(normalizeSQL(sql));
+ }
+
+ /**
+ * Normalize the given SQL statement, producing a
+ * cannonical form that is semantically equivalent to the original.
+ */
+ protected String normalizeSQL(String sql) {
+ return sql.trim();
+ }
+
+ /**
+ * My {*link KeyedPoolableObjectFactory} method for creating
+ * {*link PreparedStatement}s.
+ * @param obj the key for the {*link PreparedStatement} to be created
+ */
+ public Object makeObject(Object obj) {
+ try {
+ if(null == obj || !(obj instanceof PStmtKey)) {
+ throw new IllegalArgumentException();
+ } else {
+ // _openPstmts++;
+ PStmtKey key = (PStmtKey)obj;
+ if(null == key._resultSetType && null ==
+ key._resultSetConcurrency)
+ {
+ return new PoolablePreparedStatementStub(
+ connection.prepareStatement(key._sql),
+ key, _pstmtPool, connection);
+ } else {
+ return new PoolablePreparedStatementStub(
+ connection.prepareStatement(key._sql,
+ key._resultSetType.intValue(),
+ key._resultSetConcurrency.intValue()),
+ key, _pstmtPool, connection);
+ }
+ }
+ } catch(Exception e) {
+ throw new RuntimeException(e.toString());
+ }
+ }
+
+ /**
+ * My {*link KeyedPoolableObjectFactory} method for destroying
+ * {*link PreparedStatement}s.
+ * @param key ignored
+ * @param obj the {*link PreparedStatement} to be destroyed.
+ */
+ public void destroyObject(Object key, Object obj) {
+ //_openPstmts--;
+ try {
+ ((DelegatingPreparedStatement)obj).getInnermostDelegate().close();
+ } catch(SQLException e) {
+ // ignored
+ } catch(NullPointerException e) {
+ // ignored
+ } catch(ClassCastException e) {
+ try {
+ ((PreparedStatement)obj).close();
+ } catch(SQLException e2) {
+ // ignored
+ } catch(ClassCastException e2) {
+ // ignored
+ }
+ }
+ }
+
+ /**
+ * My {*link KeyedPoolableObjectFactory} method for validating
+ * {*link PreparedStatement}s.
+ * @param key ignored
+ * @param obj ignored
+ * @return <tt>true</tt>
+ */
+ public boolean validateObject(Object key, Object obj) {
+ return true;
+ }
+
+ /**
+ * My {*link KeyedPoolableObjectFactory} method for activating
+ * {*link PreparedStatement}s. (Currently a no-op.)
+ * @param key ignored
+ * @param obj ignored
+ */
+ public void activateObject(Object key, Object obj) {
+ // FIXME! activate is protected
+ ((PoolablePreparedStatementStub)obj).activate();
+ }
+
+ /**
+ * My {*link KeyedPoolableObjectFactory} method for passivating
+ * {*link PreparedStatement}s. Currently invokes {*link PreparedStatement#clearParameters}.
+ * @param key ignored
+ * @param obj a {*link PreparedStatement}
+ */
+ public void passivateObject(Object key, Object obj) {
+ try {
+ ((PreparedStatement)obj).clearParameters();
+ // FIXME! passivate is protected
+ ((PoolablePreparedStatementStub)obj).passivate();
+ } catch(SQLException e) {
+ // ignored
+ } catch(NullPointerException e) {
+ // ignored
+ } catch(ClassCastException e) {
+ // ignored
+ }
+ }
+
+ public String toString() {
+ return "PoolingConnection: " + _pstmtPool.toString();
+ }
+
+ /**
+ * A key uniquely identifiying {*link PreparedStatement}s.
+ */
+ class PStmtKey {
+ protected String _sql = null;
+ protected Integer _resultSetType = null;
+ protected Integer _resultSetConcurrency = null;
+
+ PStmtKey(String sql) {
+ _sql = sql;
+ }
+
+ PStmtKey(String sql, int resultSetType, int resultSetConcurrency) {
+ _sql = sql;
+ _resultSetType = new Integer(resultSetType);
+ _resultSetConcurrency = new Integer(resultSetConcurrency);
+ }
+
+ public boolean equals(Object that) {
+ try {
+ PStmtKey key = (PStmtKey)that;
+ return( ((null == _sql && null == key._sql) || _sql.equals(key._sql)) &&
+ ((null == _resultSetType && null == key._resultSetType) || _resultSetType.equals(key._resultSetType)) &&
+ ((null == _resultSetConcurrency && null == key._resultSetConcurrency) || _resultSetConcurrency.equals(key._resultSetConcurrency))
+ );
+ } catch(ClassCastException e) {
+ return false;
+ } catch(NullPointerException e) {
+ return false;
+ }
+ }
+
+ public int hashCode() {
+ return(null == _sql ? 0 : _sql.hashCode());
+ }
+
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("PStmtKey: sql=");
+ buf.append(_sql);
+ buf.append(", resultSetType=");
+ buf.append(_resultSetType);
+ buf.append(", resultSetConcurrency=");
+ buf.append(_resultSetConcurrency);
+ return buf.toString();
}
}
}
1.1 jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter/PoolablePreparedStatementStub.java
Index: PoolablePreparedStatementStub.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons-sandbox/jdbc2pool/src/java/org/apache/commons/jdbc2pool/adapter/PoolablePreparedStatementStub.java,v 1.1 2002/03/04 07:50:15 jmcnally Exp $
* $Revision: 1.1 $
* $Date: 2002/03/04 07:50:15 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.jdbc2pool.adapter;
import java.sql.PreparedStatement;
import java.sql.Connection;
import java.sql.SQLException;
import org.apache.commons.pool.KeyedObjectPool;
import org.apache.commons.dbcp.PoolablePreparedStatement;
/**
* A {*link PoolablePreparedStatement} stub since activate and passivate
* are declared protected.
*
* @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
* @version $Id: PoolablePreparedStatementStub.java,v 1.1 2002/03/04 07:50:15 jmcnally Exp $
*/
public class PoolablePreparedStatementStub
extends PoolablePreparedStatement {
/**
* Constructor
* @param stmt my underlying {*link PreparedStatement}
* @param key my key" as used by {*link KeyedObjectPool}
* @param pool the {*link KeyedObjectPool} from which I was obtained.
* @param conn the {*link Connection} from which I was created
*/
public PoolablePreparedStatementStub(PreparedStatement stmt, Object key,
KeyedObjectPool pool, Connection conn) {
super(stmt, key, pool, conn);
}
protected void activate() {
super.activate();
}
protected void passivate() {
super.passivate();
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>