[Proxool-cvs] proxool/src/java/org/logicalcobwebs/proxool ConnectionInfo.java,1.7,1.8 ConnectionInfo
UNMAINTAINED!
Brought to you by:
billhorsman
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/src/java/org/logicalcobwebs/proxool Modified Files: ConnectionInfo.java ConnectionInfoIF.java ProxyConnection.java ProxyConnectionIF.java Log Message: New sqlCalls gives list of SQL calls rather than just he most recent (for when a connection makes more than one call before being returned to the pool) Index: ConnectionInfo.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ConnectionInfo.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ConnectionInfo.java 26 Sep 2005 10:01:31 -0000 1.7 --- ConnectionInfo.java 7 Oct 2005 08:18:23 -0000 1.8 *************** *** 6,10 **** --- 6,13 ---- package org.logicalcobwebs.proxool; + import org.logicalcobwebs.proxool.util.FastArrayList; + import java.util.Date; + import java.util.List; /** *************** *** 43,47 **** private String delegateHashcode; ! private String lastSqlCall; public Date getBirthDate() { --- 46,50 ---- private String delegateHashcode; ! private List sqlCalls = new FastArrayList(); public Date getBirthDate() { *************** *** 155,164 **** } ! public String getLastSqlCall() { ! return lastSqlCall; } ! public void setLastSqlCall(String lastSqlCall) { ! this.lastSqlCall = lastSqlCall; } } --- 158,167 ---- } ! public String[] getSqlCalls() { ! return (String[]) sqlCalls.toArray(new String[0]); } ! public void addSqlCall(String sqlCall) { ! this.sqlCalls.add(sqlCall); } } *************** *** 168,171 **** --- 171,177 ---- Revision history: $Log$ + Revision 1.8 2005/10/07 08:18:23 billhorsman + New sqlCalls gives list of SQL calls rather than just he most recent (for when a connection makes more than one call before being returned to the pool) + Revision 1.7 2005/09/26 10:01:31 billhorsman Added lastSqlCall when trace is on. Index: ConnectionInfoIF.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ConnectionInfoIF.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ConnectionInfoIF.java 26 Sep 2005 10:01:31 -0000 1.11 --- ConnectionInfoIF.java 7 Oct 2005 08:18:23 -0000 1.12 *************** *** 153,157 **** * @return the most recent SQL to be used */ ! String getLastSqlCall(); } --- 153,158 ---- * @return the most recent SQL to be used */ ! String[] getSqlCalls(); ! } *************** *** 159,162 **** --- 160,166 ---- Revision history: $Log$ + Revision 1.12 2005/10/07 08:18:23 billhorsman + New sqlCalls gives list of SQL calls rather than just he most recent (for when a connection makes more than one call before being returned to the pool) + Revision 1.11 2005/09/26 10:01:31 billhorsman Added lastSqlCall when trace is on. Index: ProxyConnection.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxyConnection.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** ProxyConnection.java 26 Sep 2005 10:01:31 -0000 1.35 --- ProxyConnection.java 7 Oct 2005 08:18:24 -0000 1.36 *************** *** 9,12 **** --- 9,13 ---- import org.logicalcobwebs.logging.Log; import org.logicalcobwebs.logging.LogFactory; + import org.logicalcobwebs.proxool.util.FastArrayList; import java.sql.Connection; *************** *** 16,19 **** --- 17,21 ---- import java.util.Set; import java.util.HashSet; + import java.util.List; import java.text.DecimalFormat; *************** *** 62,66 **** private DecimalFormat idFormat = new DecimalFormat("0000"); ! private String lastSqlCall; /** * Whether we have invoked a method that requires us to reset --- 64,69 ---- private DecimalFormat idFormat = new DecimalFormat("0000"); ! private List sqlCalls = new FastArrayList(); ! /** * Whether we have invoked a method that requires us to reset *************** *** 210,214 **** public void close() throws SQLException { try { ! if (isMarkedForExpiry()) { if (connectionPool.getLog().isDebugEnabled()) { --- 213,217 ---- public void close() throws SQLException { try { ! boolean removed = false; if (isMarkedForExpiry()) { if (connectionPool.getLog().isDebugEnabled()) { *************** *** 234,242 **** if (!connectionPool.resetConnection(connection, "#" + getId())) { connectionPool.removeProxyConnection(this, "it couldn't be reset", true, true); } needToReset = false; } } ! connectionPool.putConnection(this); } catch (Throwable t) { connectionPool.getLog().error("#" + idFormat.format(getId()) + " encountered errors during closure: ", t); --- 237,250 ---- if (!connectionPool.resetConnection(connection, "#" + getId())) { connectionPool.removeProxyConnection(this, "it couldn't be reset", true, true); + removed = true; } needToReset = false; } } ! // If we removed it above then putting it back will only cause a confusing log event later when ! // it is unable to be changed from ACTIVE to AVAILABLE. ! if (!removed) { ! connectionPool.putConnection(this); ! } } catch (Throwable t) { connectionPool.getLog().error("#" + idFormat.format(getId()) + " encountered errors during closure: ", t); *************** *** 245,248 **** --- 253,264 ---- } + /** + * This gets called /just/ before a connection is served. You can use it to reset some of the attributes. + * The lifecycle is: {@link #open()} then {@link #close()} + */ + protected void open() { + sqlCalls.clear(); + } + public int getMark() { return mark; *************** *** 469,478 **** } public String getLastSqlCall() { ! return lastSqlCall; } ! public void setLastSqlCall(String lastSqlCall) { ! this.lastSqlCall = lastSqlCall; } } --- 485,502 ---- } + public String[] getSqlCalls() { + return (String[]) sqlCalls.toArray(new String[0]); + } + public String getLastSqlCall() { ! if (sqlCalls != null && sqlCalls.size() > 0) { ! return (String) sqlCalls.get(sqlCalls.size() - 1); ! } else { ! return null; ! } } ! public void addSqlCall(String sqlCall) { ! this.sqlCalls.add(sqlCall); } } Index: ProxyConnectionIF.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxyConnectionIF.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ProxyConnectionIF.java 26 Sep 2005 10:01:31 -0000 1.6 --- ProxyConnectionIF.java 7 Oct 2005 08:18:24 -0000 1.7 *************** *** 126,129 **** --- 126,135 ---- ConnectionPoolDefinitionIF getDefinition(); + /** + * Get the most recent of all the {@link #getSqlCalls()} + * @return the SQL (could be a batch of SQLs) + */ + String getLastSqlCall(); + } *************** *** 132,135 **** --- 138,144 ---- Revision history: $Log$ + Revision 1.7 2005/10/07 08:18:24 billhorsman + New sqlCalls gives list of SQL calls rather than just he most recent (for when a connection makes more than one call before being returned to the pool) + Revision 1.6 2005/09/26 10:01:31 billhorsman Added lastSqlCall when trace is on. |