More doco
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 14 Jul 2009 15:22:05 +0000 (15:22 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 14 Jul 2009 15:22:05 +0000 (15:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@793937 13f79535-47bb-0310-9956-ffa450edef68

modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java
modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimer.java
modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java

index 991bf94..c097e54 100644 (file)
@@ -28,7 +28,14 @@ import org.apache.tomcat.jdbc.pool.PoolConfiguration;
 import org.apache.tomcat.jdbc.pool.PooledConnection;
 
 /**
- * Interceptor that keep track of connection state to avoid roundtrips to the database
+ * Interceptor that keep track of connection state to avoid roundtrips to the database.
+ * The {@link org.apache.tomcat.jdbc.pool.ConnectionPool} is optimized to do as little work as possible.
+ * The pool itself doesn't remember settings like {@link java.sql.Connection#setAutoCommit(boolean)}, 
+ * {@link java.sql.Connection#setReadOnly(boolean)}, {@link java.sql.Connection#setCatalog(String)} or
+ * {@link java.sql.Connection#setTransactionIsolation(int)}. It relies on the application to remember how and when 
+ * these settings have been applied.
+ * In the cases where the application code doesn't know or want to keep track of the state, this interceptor helps cache the 
+ * state, and it also avoids roundtrips to the database asking for it.
  * @author fhanik
  *
  */
index fd0f567..9e5ec0a 100644 (file)
@@ -25,7 +25,10 @@ import org.apache.tomcat.jdbc.pool.ProxyConnection;
 
 /**
  * Class that resets the abandoned timer on any activity on the 
- * Connection or any successful query executions
+ * Connection or any successful query executions.
+ * This interceptor is useful for when you have a {@link org.apache.tomcat.jdbc.pool.PoolConfiguration#setRemoveAbandonedTimeout(int)}
+ * that is fairly low, and you want to reset the abandoned time each time any operation on the connection is performed
+ * This is useful for batch processing programs that use connections for extensive amount of times.
  * @author fhanik
  *
  */
index d947353..c643e57 100644 (file)
@@ -26,7 +26,8 @@ import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.jdbc.pool.ConnectionPool;
 import org.apache.tomcat.jdbc.pool.PooledConnection;
 /**
- * Keeps track of statements associated with a connection and invokes close upon connection.close()
+ * Keeps track of statements associated with a connection and invokes close upon {@link java.sql.Connection#close()}
+ * Useful for applications that dont close the associated statements after being done with a connection.
  * @author fhanik
  *
  */
@@ -39,7 +40,8 @@ public class StatementFinalizer extends AbstractCreateStatementInterceptor {
     public Object createStatement(Object proxy, Method method, Object[] args, Object statement, long time) {
         // TODO Auto-generated method stub
         try {
-            statements.add(new WeakReference<Statement>((Statement)statement));
+            if (statement instanceof Statement)
+                statements.add(new WeakReference<Statement>((Statement)statement));
         }catch (ClassCastException x) {
             //ignore this one
         }