proxool-cvs Mailing List for Proxool: Proxy JDBC Connection Pool (Page 3)
UNMAINTAINED!
Brought to you by:
billhorsman
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(12) |
Feb
(17) |
Mar
(20) |
Apr
(22) |
May
(4) |
Jun
(3) |
Jul
(11) |
Aug
(23) |
Sep
(60) |
Oct
(41) |
Nov
(15) |
Dec
(29) |
2004 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(5) |
Jun
(29) |
Jul
(6) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(8) |
Jun
|
Jul
(1) |
Aug
|
Sep
(8) |
Oct
(19) |
Nov
|
Dec
|
2006 |
Jan
(17) |
Feb
|
Mar
(5) |
Apr
(1) |
May
(2) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2007 |
Jan
(9) |
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(4) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <bil...@us...> - 2006-01-18 14:40:33
|
Update of /cvsroot/proxool/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30852 Modified Files: CHANGES.txt build.xml Log Message: Unbundled Jakarta's Commons Logging. Index: CHANGES.txt =================================================================== RCS file: /cvsroot/proxool/proxool/CHANGES.txt,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** CHANGES.txt 7 Oct 2005 08:26:10 -0000 1.39 --- CHANGES.txt 18 Jan 2006 14:40:06 -0000 1.40 *************** *** 62,65 **** --- 62,70 ---- process of performing). This is only overwritten when the connection is served the next time. + - Jakarta's Commons Logging is now longer bundled with the source and is now a dependency. + We had forked this component (at their version 1.02) to make it simpler for us to deploy but + there are advantages, particular with respect to configuration, to just using + the component direct from Jakarta. + 0.8.3 - 14 December 2003 Index: build.xml =================================================================== RCS file: /cvsroot/proxool/proxool/build.xml,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** build.xml 26 Sep 2005 21:47:46 -0000 1.72 --- build.xml 18 Jan 2006 14:40:06 -0000 1.73 *************** *** 27,31 **** <!-- Currect release, e.g. 0.6 --> ! <property name="release" value="0.8.9b5"/> <!-- Currect release, e.g. 0.6 --> --- 27,31 ---- <!-- Currect release, e.g. 0.6 --> ! <property name="release" value="0.9.0RC1"/> <!-- Currect release, e.g. 0.6 --> |
From: <bil...@us...> - 2006-01-18 14:40:06
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/logging/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30852/src/java/org/logicalcobwebs/logging/impl Removed Files: Jdk14Logger.java Log4JCategoryLog.java Log4jFactory.java LogFactoryImpl.java LogKitLogger.java MyPrivilegedAction.java NoOpLog.java SimpleLog.java package.html Log Message: Unbundled Jakarta's Commons Logging. --- Jdk14Logger.java DELETED --- --- Log4JCategoryLog.java DELETED --- --- Log4jFactory.java DELETED --- --- LogFactoryImpl.java DELETED --- --- LogKitLogger.java DELETED --- --- MyPrivilegedAction.java DELETED --- --- NoOpLog.java DELETED --- --- SimpleLog.java DELETED --- --- package.html DELETED --- |
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30852/src/java/org/logicalcobwebs/logging Removed Files: Log.java LogConfigurationException.java LogFactory.java LogSource.java package.html Log Message: Unbundled Jakarta's Commons Logging. --- Log.java DELETED --- --- LogConfigurationException.java DELETED --- --- LogFactory.java DELETED --- --- LogSource.java DELETED --- --- package.html DELETED --- |
From: <bil...@us...> - 2006-01-16 23:10:49
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6823/src/java/org/logicalcobwebs/proxool Modified Files: Prototyper.java Log Message: Doh. /Do/ decrement connectionCount if we didn't make one. Index: Prototyper.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/Prototyper.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Prototyper.java 2 Oct 2005 12:36:30 -0000 1.11 --- Prototyper.java 16 Jan 2006 23:10:41 -0000 1.12 *************** *** 231,242 **** synchronized (lock) { if (proxyConnection == null) { - /* - Actually, connectionCount only get incremented if it was successfully created. Don't - decrement the counter. - // If there has been an exception then we won't be using this one and // we need to decrement the counter connectionCount--; - */ } connectionsBeingMade--; --- 231,237 ---- *************** *** 319,322 **** --- 314,320 ---- Revision history: $Log$ + Revision 1.12 2006/01/16 23:10:41 billhorsman + Doh. /Do/ decrement connectionCount if we didn't make one. + Revision 1.11 2005/10/02 12:36:30 billhorsman New quickRefuse() method checks whether we are overloaded without checking whole pool for an available connection. |
From: <bil...@us...> - 2006-01-16 23:09:36
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6260/src/java/org/logicalcobwebs/proxool Modified Files: ProxyStatement.java Log Message: Call concrete finalize() method Index: ProxyStatement.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxyStatement.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ProxyStatement.java 7 Oct 2005 08:15:00 -0000 1.29 --- ProxyStatement.java 16 Jan 2006 23:09:28 -0000 1.30 *************** *** 41,44 **** --- 41,46 ---- private static final String CLOSE_METHOD = "close"; + private static final String FINALIZE_METHOD = "finalize"; + private static final String SET_NULL_METHOD = "setNull"; *************** *** 84,90 **** try { if (concreteMethod.getName().equals(EQUALS_METHOD) && argCount == 1) { ! result = new Boolean(equals(args[0])); } else if (concreteMethod.getName().equals(CLOSE_METHOD) && argCount == 0) { close(); } else { try { --- 86,94 ---- try { if (concreteMethod.getName().equals(EQUALS_METHOD) && argCount == 1) { ! result = (equals(args[0])) ? Boolean.TRUE : Boolean.FALSE; } else if (concreteMethod.getName().equals(CLOSE_METHOD) && argCount == 0) { close(); + } else if (concreteMethod.getName().equals(FINALIZE_METHOD) && argCount == 0) { + finalize(); } else { try { *************** *** 158,161 **** --- 162,168 ---- Revision history: $Log$ + Revision 1.30 2006/01/16 23:09:28 billhorsman + Call concrete finalize() method + Revision 1.29 2005/10/07 08:15:00 billhorsman Update sqlCalls /before/ we execute so that we can see what slow calls are doing before they finish. |
From: <bil...@us...> - 2005-10-07 08:26:17
|
Update of /cvsroot/proxool/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16058 Modified Files: CHANGES.txt Log Message: More changes Index: CHANGES.txt =================================================================== RCS file: /cvsroot/proxool/proxool/CHANGES.txt,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** CHANGES.txt 2 Oct 2005 15:01:04 -0000 1.38 --- CHANGES.txt 7 Oct 2005 08:26:10 -0000 1.39 *************** *** 52,55 **** --- 52,65 ---- concerned and if the pool is really busy that might take a while. Belt and braces really. + - Fixes for when a connection that exceeds the maximum-active-time and then the connection encounters + errors during removal. It ended up getting removed twice and that meant that the pool appeared to be + smaller than it was. + + - If a connection is removed because it was active for too long the SQL that it was performing is logged + (if "trace" is enabled). + + - If trace is enabled then the AdminServlet displays the SQL that each connection has performed (or is in + process of performing). This is only overwritten when the connection is served the next time. + 0.8.3 - 14 December 2003 |
From: <bil...@us...> - 2005-10-07 08:25:23
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15906/src/java/org/logicalcobwebs/proxool Modified Files: AbstractProxyStatement.java Log Message: Support new sqlCalls list and isTrace() is now true if the connection pool is being listened to or if trace is on. It no longer depends on the log level. This is because the sqlCalls are available in AdminServlet and not just the logs. Index: AbstractProxyStatement.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/AbstractProxyStatement.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** AbstractProxyStatement.java 26 Sep 2005 10:01:31 -0000 1.19 --- AbstractProxyStatement.java 7 Oct 2005 08:25:15 -0000 1.20 *************** *** 183,187 **** // Send to any listener connectionPool.onExecute(sqlLog.toString(), (System.currentTimeMillis() - startTime), exception); - ((ProxyConnection) proxyConnection).setLastSqlCall(sqlLog.toString()); } --- 183,186 ---- *************** *** 195,198 **** --- 194,203 ---- } + protected void startExecute() { + if (isTrace()) { + ((ProxyConnection) proxyConnection).addSqlCall(sqlLog.toString()); + } + } + /** * Get the parameters that have been built up and use them to fill in any parameters *************** *** 244,249 **** protected boolean isTrace() { ! boolean isTrace = getConnectionPool().isConnectionListenedTo() || (getConnectionPool().getDefinition().isTrace() && getConnectionPool().getLog().isDebugEnabled()); ! return isTrace; } --- 249,253 ---- protected boolean isTrace() { ! return getConnectionPool().isConnectionListenedTo() || (getConnectionPool().getDefinition().isTrace()); } *************** *** 261,264 **** --- 265,269 ---- return DATE_FORMAT.format(date); } + } *************** *** 267,270 **** --- 272,278 ---- Revision history: $Log$ + Revision 1.20 2005/10/07 08:25:15 billhorsman + Support new sqlCalls list and isTrace() is now true if the connection pool is being listened to or if trace is on. It no longer depends on the log level. This is because the sqlCalls are available in AdminServlet and not just the logs. + Revision 1.19 2005/09/26 10:01:31 billhorsman Added lastSqlCall when trace is on. |
From: <bil...@us...> - 2005-10-07 08:23:19
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin/servlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15624/src/java/org/logicalcobwebs/proxool/admin/servlet Modified Files: AdminServlet.java Log Message: Doc Index: AdminServlet.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin/servlet/AdminServlet.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** AdminServlet.java 2 Oct 2005 09:45:49 -0000 1.11 --- AdminServlet.java 7 Oct 2005 08:23:10 -0000 1.12 *************** *** 31,35 **** * servlet., so just configure it within your web app as you see fit. * For example, within web.xml: - * <p/> * <pre> * <servlet> --- 31,34 ---- *************** *** 45,55 **** * </init-param> * </servlet> - * <p/> * <servlet-mapping> * <servlet-name>Admin</servlet-name> ! * <url-pattern>/admin</url-pattern> * </servlet-mapping> * </pre> * * @author bill * @author $Author$ (current maintainer) --- 44,65 ---- * </init-param> * </servlet> * <servlet-mapping> * <servlet-name>Admin</servlet-name> ! * <url-pattern>/proxool</url-pattern> * </servlet-mapping> * </pre> * + * Options: + * <ul> + * <li>output: full|simple. "full" means with HTML header and body tags "simple" means + * just the HTML. Choose "simple" if you are including this servlet within your own + * web page. Note that if you choose simple output then you're probably going to want + * to consider supplying some CSS to make it look nice.</li> + * <li>cssFile: If you choose full output (see above) then some CSS is included, inline, + * in the HTML header. If you specify a URL here then that file is also linked to. It is + * linked after the inline CSS so you only have to override thos styles you want to be + * different.</li> + * </ul> + * * @author bill * @author $Author$ (current maintainer) *************** *** 61,81 **** private static final Log LOG = LogFactory.getLog(AdminServlet.class); private static final String[] STATUS_CLASSES = {"null", "available", "active", "offline"}; ! protected static final String TYPE = "type"; ! protected static final String TYPE_CONNECTIONS = "1"; ! protected static final String TYPE_ACTIVITY_LEVEL = "2"; ! public static final String OUTPUT_FULL = "full"; public static final String OUTPUT_SIMPLE = "simple"; private String output; private String cssFile; private static final String STATISTIC = "statistic"; private static final String CORE_PROPERTY = "core-property"; private static final String STANDARD_PROPERTY = "standard-property"; private static final String DELEGATED_PROPERTY = "delegated-property"; private static final String SNAPSHOT = "snapshot"; --- 71,135 ---- private static final Log LOG = LogFactory.getLog(AdminServlet.class); + /** + * The CSS class for a connection in different states: + * <ul> + * <li>null</li> + * <li>available</li> + * <li>active</li> + * <li>offline</li> + * </ul> + */ private static final String[] STATUS_CLASSES = {"null", "available", "active", "offline"}; ! /** ! * OUtput full HTML including <HTML>, <HEAD> and <BODY> tags. ! * @see #output ! * @see AdminServlet configuration ! */ public static final String OUTPUT_FULL = "full"; + /** + * OUtput simple HTML <em>excluding</em> <HTML>, <HEAD> and <BODY> tags. + * @see #output + * @see AdminServlet configuration + */ public static final String OUTPUT_SIMPLE = "simple"; + /** + * Either {@link #OUTPUT_FULL} (default) or {@link #OUTPUT_SIMPLE} + * @see AdminServlet configuration + */ private String output; + /** + * A valid URLL that can be linked to to override default, inline CSS. + * @see AdminServlet configuration + */ + private String cssFile; + + /** + * Used as part of the CSS class + */ private static final String STATISTIC = "statistic"; + + /** + * Used as part of the CSS class + */ private static final String CORE_PROPERTY = "core-property"; + + /** + * Used as part of the CSS class + */ private static final String STANDARD_PROPERTY = "standard-property"; + + /** + * Used as part of the CSS class + */ private static final String DELEGATED_PROPERTY = "delegated-property"; + + /** + * Used as part of the CSS class + */ private static final String SNAPSHOT = "snapshot"; *************** *** 105,130 **** /** * HH:mm:ss - * * @see #formatMilliseconds */ private static final DateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm:ss"); private static final DateFormat DATE_FORMAT = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.00"); private static final String DETAIL = "detail"; private static final String DETAIL_MORE = "more"; private static final String DETAIL_LESS = "less"; private static final String TAB = "tab"; private static final String TAB_DEFINITION = "definition"; private static final String TAB_SNAPSHOT = "snapshot"; private static final String TAB_STATISTICS = "statistics"; private static final String ALIAS = "alias"; private static final String CONNECTION_ID = "id"; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { --- 159,224 ---- /** * HH:mm:ss * @see #formatMilliseconds */ private static final DateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm:ss"); + /** + * dd-MMM-yyyy HH:mm:ss + */ private static final DateFormat DATE_FORMAT = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.00"); + private static final String DETAIL = "detail"; private static final String DETAIL_MORE = "more"; private static final String DETAIL_LESS = "less"; + + /** + * The request parameter name that defines: + * <ol> + * <li>{@link #TAB_DEFINITION} (default)</li> + * <li>{@link #TAB_SNAPSHOT}</li> + * <li>{@link #TAB_STATISTICS}</li> + * </ol> + */ private static final String TAB = "tab"; + + /** + * @see #TAB + */ private static final String TAB_DEFINITION = "definition"; + + /** + * @see #TAB + */ private static final String TAB_SNAPSHOT = "snapshot"; + + /** + * @see #TAB + */ private static final String TAB_STATISTICS = "statistics"; + + /** + * The request parameter name that defines the pool + */ private static final String ALIAS = "alias"; + + /** + * If we are drilling down into a connection (on the {@link #TAB_SNAPSHOT snapshot} tab then + * this points to the {@link org.logicalcobwebs.proxool.ProxyConnection#getId() ID} we are + * getting detailed information for. + */ private static final String CONNECTION_ID = "id"; + /** + * Delegate to {@link #doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)} + */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } + /** + * Show the details for a pool. + */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { *************** *** 206,209 **** --- 300,312 ---- } + /** + * Output the tabs that we are showing at the top of the page + * @param out where to write the HTNL to + * @param alias the current pool + * @param link the URL to get back to this servlet + * @param tab the active tab + * @param statisticsAvailable whether statistics are available (true if configured and ready) + * @param statisticsComingSoon whether statistics will be available (true if configured but not ready yet) + */ private void doTabs(ServletOutputStream out, String alias, String link, String tab, boolean statisticsAvailable, boolean statisticsComingSoon) throws IOException { out.println("<ul>"); *************** *** 218,221 **** --- 321,330 ---- } + /** + * Output the statistics. If there are more than one set of statistics then show them all. + * @param out where to write HTML to + * @param statisticsArray the statistics we have ready to see + * @param cpd defines the connection + */ private void doStatistics(ServletOutputStream out, StatisticsIF[] statisticsArray, ConnectionPoolDefinitionIF cpd) throws IOException { *************** *** 253,256 **** --- 362,372 ---- } + /** + * We can draw a bar chart simply enough. The two arrays passed as parameters must be of equal length + * @param out where to write the HTML + * @param colours the colur (CSS valid string) for each segment + * @param lengths the length of each segment. Can be any size since the chart just takes up as much room + * as possible as uses the relative length of each segment. + */ private void drawBarChart(StringBuffer out, String[] colours, int[] lengths) { out.append("<table style=\"margin: 8px; font-size: 50%;\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>"); *************** *** 277,283 **** --- 393,407 ---- } + /** + * Output the {@link ConnectionPoolDefinitionIF definition} + * @param out where to write the HTML + * @param cpd the definition + */ private void doDefinition(ServletOutputStream out, ConnectionPoolDefinitionIF cpd) throws IOException { openDataTable(out); + /* + TODO: it would be nice to have meta-data in the definition so that this is much easier. + */ printDefinitionEntry(out, ProxoolConstants.ALIAS, cpd.getAlias(), CORE_PROPERTY); printDefinitionEntry(out, ProxoolConstants.DRIVER_URL, cpd.getUrl(), CORE_PROPERTY); *************** *** 318,321 **** --- 442,446 ---- printDefinitionEntry(out, ProxoolConstants.VERBOSE, String.valueOf(cpd.isVerbose()), STANDARD_PROPERTY); printDefinitionEntry(out, ProxoolConstants.TRACE, String.valueOf(cpd.isTrace()), STANDARD_PROPERTY); + // Now all the properties that are forwarded to the delegate driver. Properties p = cpd.getDelegateProperties(); Iterator i = p.keySet().iterator(); *************** *** 323,326 **** --- 448,452 ---- String name = (String) i.next(); String value = p.getProperty(name); + // Better hide the password! if (name.toLowerCase().indexOf("password") > -1 || name.toLowerCase().indexOf("passwd") > -1) { value = "******"; *************** *** 333,336 **** --- 459,470 ---- } + /** + * Output a {@link SnapshotIF snapshot} of the pool. + * @param out where to write the HTML + * @param cpd defines the pool + * @param link the URL back to this servlet + * @param level either {@link #DETAIL_LESS} or {@link #DETAIL_MORE} + * @param connectionId the connection we want to drill into (optional) + */ private void doSnapshot(ServletOutputStream out, ConnectionPoolDefinitionIF cpd, String link, String level, String connectionId) throws IOException, ProxoolException { boolean detail = (level != null && level.equals(DETAIL_MORE)); *************** *** 427,430 **** --- 561,575 ---- } + /** + * If we want a {@link #DETAIL_MORE more} detailed {@link SnapshotIF snapshot} then {@link #doSnapshot(javax.servlet.ServletOutputStream, org.logicalcobwebs.proxool.ConnectionPoolDefinitionIF, String, String, String)} + * calls this too + * @param out where to write the HTML + * @param cpd defines the pool + * @param snapshot snapshot + * @param link the URL back to this servlet + * @param connectionId the connection we want to drill into (optional) + * @param connectionId + * @throws IOException + */ private void doSnapshotDetails(ServletOutputStream out, ConnectionPoolDefinitionIF cpd, SnapshotIF snapshot, String link, String connectionId) throws IOException { *************** *** 534,537 **** --- 679,688 ---- } + /** + * What CSS class to use for a particular connection. + * @param info so we know the {@link org.logicalcobwebs.proxool.ConnectionInfoIF#getStatus()} status + * @return the CSS class + * @see #STATUS_CLASSES + */ private static String getStatusClass(ConnectionInfoIF info) { try { *************** *** 545,553 **** private void doDrillDownConnection(ServletOutputStream out, ConnectionInfoIF drillDownConnection) throws IOException { ! // proxy ! if (drillDownConnection.getLastSqlCall() != null) { out.print("<div class=\"drill-down\">"); out.print("sql = "); ! out.print(drillDownConnection.getLastSqlCall()); out.print("</div>"); } --- 696,706 ---- private void doDrillDownConnection(ServletOutputStream out, ConnectionInfoIF drillDownConnection) throws IOException { ! // sql calls ! String[] sqlCalls = drillDownConnection.getSqlCalls(); ! for (int i = 0; sqlCalls != null && i < sqlCalls.length; i++) { ! String sqlCall = sqlCalls[i]; out.print("<div class=\"drill-down\">"); out.print("sql = "); ! out.print(sqlCall); out.print("</div>"); } *************** *** 634,637 **** --- 787,798 ---- } + /** + * Output the list of available connection pools. If there are none then display a message saying that. + * If there is only one then just display nothing (and the pool will displayed by default) + * @param out where to write the HTML + * @param alias identifies the current pool + * @param tab identifies the tab we are on so that changing pools doesn't change the tab + * @param link the URL back to this servlet + */ private void doList(ServletOutputStream out, String alias, String tab, String link) throws IOException { *************** *** 679,682 **** --- 840,846 ---- Revision history: $Log$ + Revision 1.12 2005/10/07 08:23:10 billhorsman + Doc + Revision 1.11 2005/10/02 09:45:49 billhorsman Layout |
From: <bil...@us...> - 2005-10-07 08:22:00
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15414/src/java/org/logicalcobwebs/proxool Modified Files: ConnectionResetter.java Log Message: New hook to allow unit tests to trigger a deliberate exception during reset Index: ConnectionResetter.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ConnectionResetter.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ConnectionResetter.java 10 Mar 2003 23:43:10 -0000 1.14 --- ConnectionResetter.java 7 Oct 2005 08:21:53 -0000 1.15 *************** *** 57,60 **** --- 57,65 ---- /** + * @see #isTriggerResetException() + */ + protected static boolean triggerResetException; + + /** * Pass in the log to use * @param log debug information sent here *************** *** 288,291 **** --- 293,301 ---- } + if (isTriggerResetException()) { + log.warn("Triggering pretend exception during reset"); + errorsEncountered = true; + } + if (errorsEncountered) { *************** *** 301,304 **** --- 311,326 ---- } + private static boolean isTriggerResetException() { + return triggerResetException; + } + + /** + * Called by a unit test. + * @param triggerResetException true it we should trigger a pretend exception. + * @see #isTriggerResetException() + */ + protected static void setTriggerResetException(boolean triggerResetException) { + ConnectionResetter.triggerResetException = triggerResetException; + } } *************** *** 306,309 **** --- 328,334 ---- Revision history: $Log$ + Revision 1.15 2005/10/07 08:21:53 billhorsman + New hook to allow unit tests to trigger a deliberate exception during reset + Revision 1.14 2003/03/10 23:43:10 billhorsman reapplied checkstyle that i'd inadvertently let |
From: <bil...@us...> - 2005-10-07 08:19:12
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14790/src/java/org/logicalcobwebs/proxool Modified Files: ConnectionPool.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: ConnectionPool.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ConnectionPool.java,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** ConnectionPool.java 2 Oct 2005 12:32:02 -0000 1.81 --- ConnectionPool.java 7 Oct 2005 08:19:05 -0000 1.82 *************** *** 260,263 **** --- 260,266 ---- } + // This gives the proxy connection a chance to reset itself before it is served. + proxyConnection.open(); + return ProxyFactory.getWrappedConnection(proxyConnection); } *************** *** 841,845 **** ci.setProxyHashcode(connectionInfo.getProxyHashcode()); ci.setDelegateHashcode(connectionInfo.getDelegateHashcode()); ! ci.setLastSqlCall(connectionInfo.getLastSqlCall()); cis.add(ci); } --- 844,851 ---- ci.setProxyHashcode(connectionInfo.getProxyHashcode()); ci.setDelegateHashcode(connectionInfo.getDelegateHashcode()); ! String[] sqlCalls = connectionInfo.getSqlCalls(); ! for (int j = 0; j < sqlCalls.length; j++) { ! ci.addSqlCall(sqlCalls[j]); ! } cis.add(ci); } *************** *** 1109,1112 **** --- 1115,1121 ---- Revision history: $Log$ + Revision 1.82 2005/10/07 08:19:05 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.81 2005/10/02 12:32:02 billhorsman Make connectionCount available to statistics |
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. |
From: <bil...@us...> - 2005-10-07 08:15:09
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14122/src/java/org/logicalcobwebs/proxool Modified Files: ProxyStatement.java Log Message: Update sqlCalls /before/ we execute so that we can see what slow calls are doing before they finish. Index: ProxyStatement.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxyStatement.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ProxyStatement.java 13 Jul 2004 21:06:18 -0000 1.28 --- ProxyStatement.java 7 Oct 2005 08:15:00 -0000 1.29 *************** *** 59,62 **** --- 59,82 ---- Method concreteMethod = InvokerFacade.getConcreteMethod(getStatement().getClass(), method); + + // This gets called /before/ the method has run + if (concreteMethod.getName().equals(ADD_BATCH_METHOD)) { + // If we have just added a batch call then we need to update the sql log + if (argCount > 0 && args[0] instanceof String) { + setSqlStatementIfNull((String) args[0]); + } + appendToSqlLog(); + } else if (concreteMethod.getName().equals(EXECUTE_BATCH_METHOD)) { + // executing a batch should do a trace + startExecute(); + } else if (concreteMethod.getName().startsWith(EXECUTE_FRAGMENT)) { + // executing should update the log and do a trace + if (argCount > 0 && args[0] instanceof String) { + setSqlStatementIfNull((String) args[0]); + } + appendToSqlLog(); + startExecute(); + } + // We need to remember an exceptions that get thrown so that we can optionally // pass them to the onExecute() call below *************** *** 122,140 **** } finally { ! if (concreteMethod.getName().equals(ADD_BATCH_METHOD)) { ! // If we have just added a batch call then we need to update the sql log ! if (argCount > 0 && args[0] instanceof String) { ! setSqlStatementIfNull((String) args[0]); ! } ! appendToSqlLog(); ! } else if (concreteMethod.getName().equals(EXECUTE_BATCH_METHOD)) { ! // executing a batch should do a trace ! trace(startTime, exception); ! } else if (concreteMethod.getName().startsWith(EXECUTE_FRAGMENT)) { ! // executing should update the log and do a trace ! if (argCount > 0 && args[0] instanceof String) { ! setSqlStatementIfNull((String) args[0]); ! } ! appendToSqlLog(); trace(startTime, exception); } --- 142,147 ---- } finally { ! // This gets called /after/ the method has run ! if (concreteMethod.getName().equals(EXECUTE_BATCH_METHOD) || concreteMethod.getName().startsWith(EXECUTE_FRAGMENT)) { trace(startTime, exception); } *************** *** 151,154 **** --- 158,164 ---- Revision history: $Log$ + Revision 1.29 2005/10/07 08:15:00 billhorsman + Update sqlCalls /before/ we execute so that we can see what slow calls are doing before they finish. + Revision 1.28 2004/07/13 21:06:18 billhorsman Fix problem using injectable interfaces on methods that are declared in non-public classes. |
From: <bil...@us...> - 2005-10-07 08:13:54
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13940/src/java-test/org/logicalcobwebs/proxool/admin Modified Files: SnapshotTest.java Log Message: Test new sqlCalls property of snapshot Index: SnapshotTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/admin/SnapshotTest.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SnapshotTest.java 10 Mar 2003 23:46:43 -0000 1.12 --- SnapshotTest.java 7 Oct 2005 08:13:46 -0000 1.13 *************** *** 17,20 **** --- 17,21 ---- import java.sql.Connection; import java.sql.DriverManager; + import java.sql.Statement; import java.util.Properties; *************** *** 53,56 **** --- 54,58 ---- info.setProperty(ProxoolConstants.STATISTICS_PROPERTY, "10s,15s"); info.setProperty(ProxoolConstants.MINIMUM_CONNECTION_COUNT_PROPERTY, "1"); + info.setProperty(ProxoolConstants.TRACE_PROPERTY, "true"); // We don't test whether anything is logged, but this line should make something appear *************** *** 61,65 **** { ! DriverManager.getConnection(url).close(); SnapshotIF snapshot = ProxoolFacade.getSnapshot(alias, true); --- 63,69 ---- { ! Connection connection = DriverManager.getConnection(url); ! connection.createStatement().execute(TestConstants.HYPERSONIC_TEST_SQL); ! connection.close(); SnapshotIF snapshot = ProxoolFacade.getSnapshot(alias, true); *************** *** 72,79 **** assertTrue("connectionInfos.length != 0", connectionInfos.length != 0); assertEquals("connectionInfos activeCount", 0, getCount(connectionInfos, ConnectionInfoIF.STATUS_ACTIVE)); } { ! Connection c = DriverManager.getConnection(url); SnapshotIF snapshot = ProxoolFacade.getSnapshot(alias, true); --- 76,87 ---- assertTrue("connectionInfos.length != 0", connectionInfos.length != 0); assertEquals("connectionInfos activeCount", 0, getCount(connectionInfos, ConnectionInfoIF.STATUS_ACTIVE)); + assertEquals("connectionInfos sql count", 1, connectionInfos[0].getSqlCalls().length); + assertEquals("connectionInfos lastSql", TestConstants.HYPERSONIC_TEST_SQL, connectionInfos[0].getSqlCalls()[0].replace(';', ' ').trim()); } { ! Connection connection = DriverManager.getConnection(url); ! connection.createStatement().execute(TestConstants.HYPERSONIC_TEST_SQL); ! connection.createStatement().execute(TestConstants.HYPERSONIC_TEST_SQL_2); SnapshotIF snapshot = ProxoolFacade.getSnapshot(alias, true); *************** *** 86,91 **** assertTrue("connectionInfos.length != 0", connectionInfos.length != 0); assertEquals("connectionInfos activeCount", 1, getCount(connectionInfos, ConnectionInfoIF.STATUS_ACTIVE)); ! c.close(); } --- 94,102 ---- assertTrue("connectionInfos.length != 0", connectionInfos.length != 0); assertEquals("connectionInfos activeCount", 1, getCount(connectionInfos, ConnectionInfoIF.STATUS_ACTIVE)); + assertEquals("connectionInfos sql count", 2, connectionInfos[0].getSqlCalls().length); + assertEquals("connectionInfos lastSql", TestConstants.HYPERSONIC_TEST_SQL, connectionInfos[0].getSqlCalls()[0].replace(';', ' ').trim()); + assertEquals("connectionInfos lastSql", TestConstants.HYPERSONIC_TEST_SQL_2, connectionInfos[0].getSqlCalls()[1].replace(';', ' ').trim()); ! connection.close(); } *************** *** 107,110 **** --- 118,124 ---- Revision history: $Log$ + Revision 1.13 2005/10/07 08:13:46 billhorsman + Test new sqlCalls property of snapshot + Revision 1.12 2003/03/10 23:46:43 billhorsman checkstyle |
From: <bil...@us...> - 2005-10-07 08:13:10
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13866/src/java-test/org/logicalcobwebs/proxool Modified Files: ConnectionResetterTest.java Log Message: Test deliberate exception durinng reset Index: ConnectionResetterTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/ConnectionResetterTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ConnectionResetterTest.java 4 Mar 2003 10:58:43 -0000 1.14 --- ConnectionResetterTest.java 7 Oct 2005 08:12:58 -0000 1.15 *************** *** 50,56 **** Connection c1 = DriverManager.getConnection(url); ! ; Connection c2 = DriverManager.getConnection(url); ! ; c1.setAutoCommit(false); --- 50,56 ---- Connection c1 = DriverManager.getConnection(url); ! Connection c2 = DriverManager.getConnection(url); ! c1.setAutoCommit(false); *************** *** 62,65 **** --- 62,98 ---- c2.close(); c1.close(); + assertEquals("connectionCount", 2, ProxoolFacade.getSnapshot(alias).getConnectionCount()); + + } + + /** + * Test connectionCount when we deliberately introduce an exception during connection reset. + */ + public void testFailedReset() throws Exception { + + try { + // This is a bit of a hack to force an exception during reset + ConnectionResetter.setTriggerResetException(true); + + String testName = "failedReset"; + String alias = testName; + + String url = TestHelper.buildProxoolUrl(alias, + TestConstants.HYPERSONIC_DRIVER, + TestConstants.HYPERSONIC_TEST_URL); + Properties info = new Properties(); + info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER); + info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); + ProxoolFacade.registerConnectionPool(url, info); + + Connection c1 = DriverManager.getConnection(url); + c1.setAutoCommit(false); + c1.close(); + + assertEquals("connectionCount", 0, ProxoolFacade.getSnapshot(alias).getConnectionCount()); + } finally { + // Back to normal + ConnectionResetter.setTriggerResetException(false); + } } *************** *** 106,109 **** --- 139,145 ---- Revision history: $Log$ + Revision 1.15 2005/10/07 08:12:58 billhorsman + Test deliberate exception durinng reset + Revision 1.14 2003/03/04 10:58:43 billhorsman checkstyle |
From: <bil...@us...> - 2005-10-07 08:11:43
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13613/src/java-test/org/logicalcobwebs/proxool Modified Files: HouseKeeperTest.java Log Message: New test for reset failure Index: HouseKeeperTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/HouseKeeperTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** HouseKeeperTest.java 2 Oct 2005 12:30:59 -0000 1.10 --- HouseKeeperTest.java 7 Oct 2005 08:11:34 -0000 1.11 *************** *** 19,25 **** * Test the house keeper in ConnectionPool * - * @version $Revision$, $Date$ * @author bill * @author $Author$ (current maintainer) * @since Proxool 0.8 */ --- 19,25 ---- * Test the house keeper in ConnectionPool * * @author bill * @author $Author$ (current maintainer) + * @version $Revision$, $Date$ * @since Proxool 0.8 */ *************** *** 38,41 **** --- 38,42 ---- public void testMaximumActiveTime() throws Exception { + ConnectionResetter.setTriggerResetException(true); String testName = "maximumActiveTime"; String alias = testName; *************** *** 56,59 **** --- 57,61 ---- final Connection connection = DriverManager.getConnection(url); + connection.setAutoCommit(false); connection.createStatement().executeQuery(TestConstants.HYPERSONIC_TEST_SQL); long start = System.currentTimeMillis(); *************** *** 102,105 **** --- 104,183 ---- /** + * Test that connections that remain active for longer than the configured + * time are closed (and destroyed) automatically. Also, it gets errors during + * reset. We don't want the connectionCount to be decremented twice. + */ + public void testMaximumActiveTimeWithResetFailure() throws Exception { + + try { + ConnectionResetter.setTriggerResetException(true); + String testName = "maximumActiveTime"; + String alias = testName; + + String url = TestHelper.buildProxoolUrl(alias, + TestConstants.HYPERSONIC_DRIVER, + TestConstants.HYPERSONIC_TEST_URL); + Properties info = new Properties(); + info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER); + info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); + info.setProperty(ProxoolConstants.MAXIMUM_ACTIVE_TIME_PROPERTY, "1000"); + info.setProperty(ProxoolConstants.TRACE_PROPERTY, "true"); + info.setProperty(ProxoolConstants.HOUSE_KEEPING_SLEEP_TIME_PROPERTY, "1000"); + ProxoolFacade.registerConnectionPool(url, info); + + assertEquals("Shouldn't be any active connections yet", 0, ProxoolFacade.getSnapshot(alias, false).getServedCount()); + + final Connection connection = DriverManager.getConnection(url); + connection.setAutoCommit(false); + connection.createStatement().executeQuery(TestConstants.HYPERSONIC_TEST_SQL); + long start = System.currentTimeMillis(); + + assertEquals("We just opened 1 connection", 1, ProxoolFacade.getSnapshot(alias, false).getServedCount()); + + new ResultMonitor() { + public boolean check() throws Exception { + return connection.isClosed(); + } + }.getResult(); + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + LOG.debug("Awoken."); + } + + long elapsed = System.currentTimeMillis() - start; + assertTrue("Connection has not been closed after " + elapsed + " milliseconds as expected", connection.isClosed()); + assertEquals("Expected the connection to be inactive", 0, ProxoolFacade.getSnapshot(alias, false).getActiveConnectionCount()); + + try { + connection.createStatement().executeQuery(TestConstants.HYPERSONIC_TEST_SQL); + fail("Calling createStatement() on a closed connection should fail"); + } catch (Exception e) { + // s'okay. We expected this + LOG.debug("Ignoring expected exception: " + e.getMessage()); + } + + // Now close the connection ourselves. It's already been closed by the House Keeper but nothing bad should + // happen if we do it again now. + connection.close(); + + // Let's see if the prototyper builds another one + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + LOG.debug("Awoken."); + } + SnapshotIF snapshot = ProxoolFacade.getSnapshot(alias, false); + assertEquals("activeConnectionCount", 0, snapshot.getActiveConnectionCount()); + assertEquals("availableConnectionCount", 0, snapshot.getAvailableConnectionCount()); + assertEquals("connectionCount", 0, snapshot.getConnectionCount()); + } finally { + // Back to normal + ConnectionResetter.setTriggerResetException(false); + } + + } + + /** * Test that house keeper destroys connections that fail configured * the test sql *************** *** 247,284 **** } - /* ! Revision history: ! $Log$ ! Revision 1.10 2005/10/02 12:30:59 billhorsman ! Improved test by checking connectionCount ! Revision 1.9 2004/06/02 21:05:19 billhorsman ! Don't log worrying stack traces for expected exceptions. ! Revision 1.8 2003/09/30 18:40:16 billhorsman ! New tests for test-before-use and test-after-use ! Revision 1.7 2003/09/11 23:58:05 billhorsman ! New test for house-keeper-test-sql ! Revision 1.6 2003/03/04 10:24:40 billhorsman ! removed try blocks around each test ! Revision 1.5 2003/03/03 17:08:57 billhorsman ! all tests now extend AbstractProxoolTest ! Revision 1.4 2003/03/03 11:12:04 billhorsman ! fixed licence ! Revision 1.3 2003/03/02 00:53:49 billhorsman ! more robust wait ! Revision 1.2 2003/03/01 15:27:24 billhorsman ! checkstyle ! Revision 1.1 2003/02/27 18:01:48 billhorsman ! completely rethought the test structure. it's now ! more obvious. no new tests yet though. ! */ \ No newline at end of file --- 325,364 ---- } /* ! Revision history: ! $Log$ ! Revision 1.11 2005/10/07 08:11:34 billhorsman ! New test for reset failure ! Revision 1.10 2005/10/02 12:30:59 billhorsman ! Improved test by checking connectionCount ! Revision 1.9 2004/06/02 21:05:19 billhorsman ! Don't log worrying stack traces for expected exceptions. ! Revision 1.8 2003/09/30 18:40:16 billhorsman ! New tests for test-before-use and test-after-use ! Revision 1.7 2003/09/11 23:58:05 billhorsman ! New test for house-keeper-test-sql ! Revision 1.6 2003/03/04 10:24:40 billhorsman ! removed try blocks around each test ! Revision 1.5 2003/03/03 17:08:57 billhorsman ! all tests now extend AbstractProxoolTest ! Revision 1.4 2003/03/03 11:12:04 billhorsman ! fixed licence ! Revision 1.3 2003/03/02 00:53:49 billhorsman ! more robust wait ! Revision 1.2 2003/03/01 15:27:24 billhorsman ! checkstyle ! Revision 1.1 2003/02/27 18:01:48 billhorsman ! completely rethought the test structure. it's now ! more obvious. no new tests yet though. ! ! */ \ No newline at end of file |
From: <bil...@us...> - 2005-10-07 08:10:42
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13472/src/java-test/org/logicalcobwebs/proxool Modified Files: TestConstants.java Log Message: Second test SQL Index: TestConstants.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/TestConstants.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TestConstants.java 26 May 2004 17:19:09 -0000 1.6 --- TestConstants.java 7 Oct 2005 08:10:33 -0000 1.7 *************** *** 59,62 **** --- 59,67 ---- /** + * SQL statement that should always succeed + */ + public static String HYPERSONIC_TEST_SQL_2 = "SELECT COUNT(2) FROM SYSTEM_CATALOGS"; + + /** * SQL statement that should always fail */ *************** *** 72,75 **** --- 77,83 ---- Revision history: $Log$ + Revision 1.7 2005/10/07 08:10:33 billhorsman + Second test SQL + Revision 1.6 2004/05/26 17:19:09 brenuart Allow JUnit tests to be executed against another database. |
From: <bil...@us...> - 2005-10-02 23:30:26
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12142/src/java/org/logicalcobwebs/proxool Modified Files: Prototyper.java Log Message: New quickRefuse() method checks whether we are overloaded without checking whole pool for an available connection. Index: Prototyper.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/Prototyper.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Prototyper.java 4 May 2005 16:27:54 -0000 1.10 --- Prototyper.java 2 Oct 2005 12:36:30 -0000 1.11 *************** *** 231,237 **** --- 231,242 ---- synchronized (lock) { if (proxyConnection == null) { + /* + Actually, connectionCount only get incremented if it was successfully created. Don't + decrement the counter. + // If there has been an exception then we won't be using this one and // we need to decrement the counter connectionCount--; + */ } connectionsBeingMade--; *************** *** 296,299 **** --- 301,316 ---- } + /** + * Give a quick answer to whether we should attempt to build a connection. This can be quicker + * if we are massively overloaded rather than cycling through each connection in the pool to + * see if it's free + * @return true if it's okay to attempt to get a connection, false if we should give up now. Just + * because this method returns true it doesn't guarantee that one will be available. There is a slight + * risk that we might tell the client to give up when a connection could become available in the next few + * milliseconds but our policy is to refuse connections quickly when overloaded. + */ + public boolean quickRefuse() { + return connectionCount >= getDefinition().getMaximumConnectionCount() && connectionPool.getAvailableConnectionCount() < 1; + } } *************** *** 302,305 **** --- 319,325 ---- Revision history: $Log$ + Revision 1.11 2005/10/02 12:36:30 billhorsman + New quickRefuse() method checks whether we are overloaded without checking whole pool for an available connection. + Revision 1.10 2005/05/04 16:27:54 billhorsman Check to see whether a new connection was really added to the pool. |
From: <bil...@us...> - 2005-10-02 23:06:49
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11208/src/java/org/logicalcobwebs/proxool/admin Modified Files: Admin.java Snapshot.java SnapshotIF.java Log Message: Make connectionCount available to statistics Index: Admin.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin/Admin.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Admin.java 27 Oct 2003 20:26:19 -0000 1.7 --- Admin.java 2 Oct 2005 12:32:01 -0000 1.8 *************** *** 147,150 **** --- 147,151 ---- s.setRefusedCount(cps.getConnectionsRefusedCount()); s.setConnectionInfos(connectionInfos); + s.setConnectionCount(cps.getConnectionCount()); /* *************** *** 169,172 **** --- 170,176 ---- Revision history: $Log$ + Revision 1.8 2005/10/02 12:32:01 billhorsman + Make connectionCount available to statistics + Revision 1.7 2003/10/27 20:26:19 billhorsman connectionReturned() and connectionRefused() calls will now log any errors and continue rather than Index: Snapshot.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin/Snapshot.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Snapshot.java 10 Mar 2003 15:26:51 -0000 1.3 --- Snapshot.java 2 Oct 2005 12:32:01 -0000 1.4 *************** *** 43,46 **** --- 43,48 ---- private Collection connectionInfos; + private long connectionCount; + /** * @param snapshotDate see {@link org.logicalcobwebs.proxool.admin.SnapshotIF#getSnapshotDate} *************** *** 190,193 **** --- 192,202 ---- } + public long getConnectionCount() { + return connectionCount; + } + + public void setConnectionCount(long connectionCount) { + this.connectionCount = connectionCount; + } } *************** *** 196,199 **** --- 205,211 ---- Revision history: $Log$ + Revision 1.4 2005/10/02 12:32:01 billhorsman + Make connectionCount available to statistics + Revision 1.3 2003/03/10 15:26:51 billhorsman refactoringn of concurrency stuff (and some import Index: SnapshotIF.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin/SnapshotIF.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SnapshotIF.java 3 Mar 2003 11:11:59 -0000 1.2 --- SnapshotIF.java 2 Oct 2005 12:32:01 -0000 1.3 *************** *** 94,97 **** --- 94,99 ---- */ boolean isDetail(); + + long getConnectionCount(); } *************** *** 100,103 **** --- 102,108 ---- Revision history: $Log$ + Revision 1.3 2005/10/02 12:32:01 billhorsman + Make connectionCount available to statistics + Revision 1.2 2003/03/03 11:11:59 billhorsman fixed licence |
From: <bil...@us...> - 2005-10-02 23:00:22
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10914/src/java-test/org/logicalcobwebs/proxool Modified Files: HouseKeeperTest.java Log Message: Improved test by checking connectionCount Index: HouseKeeperTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/HouseKeeperTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** HouseKeeperTest.java 2 Jun 2004 21:05:19 -0000 1.9 --- HouseKeeperTest.java 2 Oct 2005 12:30:59 -0000 1.10 *************** *** 8,11 **** --- 8,12 ---- import org.logicalcobwebs.logging.Log; import org.logicalcobwebs.logging.LogFactory; + import org.logicalcobwebs.proxool.admin.SnapshotIF; import java.sql.Connection; *************** *** 47,50 **** --- 48,53 ---- info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); info.setProperty(ProxoolConstants.MAXIMUM_ACTIVE_TIME_PROPERTY, "1000"); + info.setProperty(ProxoolConstants.MINIMUM_CONNECTION_COUNT_PROPERTY, "1"); + info.setProperty(ProxoolConstants.TRACE_PROPERTY, "true"); info.setProperty(ProxoolConstants.HOUSE_KEEPING_SLEEP_TIME_PROPERTY, "1000"); ProxoolFacade.registerConnectionPool(url, info); *************** *** 53,57 **** final Connection connection = DriverManager.getConnection(url); ! ; long start = System.currentTimeMillis(); --- 56,60 ---- final Connection connection = DriverManager.getConnection(url); ! connection.createStatement().executeQuery(TestConstants.HYPERSONIC_TEST_SQL); long start = System.currentTimeMillis(); *************** *** 71,77 **** long elapsed = System.currentTimeMillis() - start; assertTrue("Connection has not been closed after " + elapsed + " milliseconds as expected", connection.isClosed()); - assertEquals("Expected the connection to be inactive", 0, ProxoolFacade.getSnapshot(alias, false).getActiveConnectionCount()); } --- 74,102 ---- long elapsed = System.currentTimeMillis() - start; assertTrue("Connection has not been closed after " + elapsed + " milliseconds as expected", connection.isClosed()); assertEquals("Expected the connection to be inactive", 0, ProxoolFacade.getSnapshot(alias, false).getActiveConnectionCount()); + try { + connection.createStatement().executeQuery(TestConstants.HYPERSONIC_TEST_SQL); + fail("Calling createStatement() on a closed connection should fail"); + } catch (Exception e) { + // s'okay. We expected this + LOG.debug("Ignoring expected exception: " + e.getMessage()); + } + + // Now close the connection ourselves. It's already been closed by the House Keeper but nothing bad should + // happen if we do it again now. + connection.close(); + + // Let's see if the prototyper builds another one + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + LOG.debug("Awoken."); + } + SnapshotIF snapshot = ProxoolFacade.getSnapshot(alias, false); + assertEquals("activeConnectionCount", 0, snapshot.getActiveConnectionCount()); + assertEquals("availableConnectionCount", 1, snapshot.getAvailableConnectionCount()); + assertEquals("connectionCount", 1, snapshot.getConnectionCount()); + } *************** *** 226,229 **** --- 251,257 ---- Revision history: $Log$ + Revision 1.10 2005/10/02 12:30:59 billhorsman + Improved test by checking connectionCount + Revision 1.9 2004/06/02 21:05:19 billhorsman Don't log worrying stack traces for expected exceptions. |
From: <bil...@us...> - 2005-10-02 22:55:03
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11208/src/java/org/logicalcobwebs/proxool Modified Files: ConnectionPool.java ConnectionPoolStatisticsIF.java Log Message: Make connectionCount available to statistics Index: ConnectionPool.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ConnectionPool.java,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** ConnectionPool.java 26 Sep 2005 09:54:14 -0000 1.80 --- ConnectionPool.java 2 Oct 2005 12:32:02 -0000 1.81 *************** *** 65,74 **** private int nextAvailableConnection = 0; - /** - * This is usually the same as poolableConnections.size() but it sometimes higher. It is - * alwasy right, since a connection exists before it is added to the pool - */ - private int connectionCount = 0; - private long connectionsServedCount = 0; --- 65,68 ---- *************** *** 161,165 **** */ ! if (connectionCount >= getDefinition().getMaximumConnectionCount() && getAvailableConnectionCount() < 1) { connectionsRefusedCount++; if (admin != null) { --- 155,159 ---- */ ! if (prototyper.quickRefuse()) { connectionsRefusedCount++; if (admin != null) { *************** *** 477,481 **** acquirePrimaryWriteLock(); ! if (connectionPoolUp == true) { connectionPoolUp = false; --- 471,475 ---- acquirePrimaryWriteLock(); ! if (connectionPoolUp) { connectionPoolUp = false; *************** *** 700,707 **** protected void registerRemovedConnection(int status) { - connectionCount--; - prototyper.connectionRemoved(); - connectionCountByState[status]--; } --- 694,698 ---- *************** *** 1109,1112 **** --- 1100,1107 ---- return prototyper; } + + public long getConnectionCount() { + return getPrototyper().getConnectionCount(); + } } *************** *** 1114,1117 **** --- 1109,1115 ---- Revision history: $Log$ + Revision 1.81 2005/10/02 12:32:02 billhorsman + Make connectionCount available to statistics + Revision 1.80 2005/09/26 09:54:14 billhorsman Avoid suspected deadlock when getting a detailed snapshot. Only attempt to get the concurrent lock for 10 seconds before giving up. Index: ConnectionPoolStatisticsIF.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ConnectionPoolStatisticsIF.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ConnectionPoolStatisticsIF.java 3 Mar 2003 11:11:57 -0000 1.5 --- ConnectionPoolStatisticsIF.java 2 Oct 2005 12:32:02 -0000 1.6 *************** *** 63,66 **** --- 63,67 ---- Date getDateStarted(); + long getConnectionCount(); } *************** *** 68,71 **** --- 69,75 ---- Revision history: $Log$ + Revision 1.6 2005/10/02 12:32:02 billhorsman + Make connectionCount available to statistics + Revision 1.5 2003/03/03 11:11:57 billhorsman fixed licence |
From: <bil...@us...> - 2005-10-02 21:40:57
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin/servlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15664/src/java/org/logicalcobwebs/proxool/admin/servlet Modified Files: AdminServlet.java Log Message: Layout Index: AdminServlet.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin/servlet/AdminServlet.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AdminServlet.java 26 Sep 2005 21:47:46 -0000 1.10 --- AdminServlet.java 2 Oct 2005 09:45:49 -0000 1.11 *************** *** 31,35 **** * servlet., so just configure it within your web app as you see fit. * For example, within web.xml: ! * * <pre> * <servlet> --- 31,35 ---- * servlet., so just configure it within your web app as you see fit. * For example, within web.xml: ! * <p/> * <pre> * <servlet> *************** *** 45,49 **** * </init-param> * </servlet> ! * * <servlet-mapping> * <servlet-name>Admin</servlet-name> --- 45,49 ---- * </init-param> * </servlet> ! * <p/> * <servlet-mapping> * <servlet-name>Admin</servlet-name> *************** *** 52,58 **** * </pre> * - * @version $Revision$, $Date$ * @author bill * @author $Author$ (current maintainer) * @since Proxool 0.7 */ --- 52,58 ---- * </pre> * * @author bill * @author $Author$ (current maintainer) + * @version $Revision$, $Date$ * @since Proxool 0.7 */ *************** *** 105,108 **** --- 105,109 ---- /** * HH:mm:ss + * * @see #formatMilliseconds */ *************** *** 168,172 **** String snapshotConnectionId = request.getParameter(CONNECTION_ID); - try { if (output.equals(OUTPUT_FULL)) { --- 169,172 ---- *************** *** 189,194 **** doDefinition(response.getOutputStream(), def); } else if (tab.equals(TAB_SNAPSHOT)) { ! doSnapshot(response.getOutputStream(), alias, link, snapshotDetail, snapshotConnectionId); ! } else if (tab.equals(TAB_STATISTICS)){ doStatistics(response.getOutputStream(), statisticsArray, def); } else { --- 189,194 ---- doDefinition(response.getOutputStream(), def); } else if (tab.equals(TAB_SNAPSHOT)) { ! doSnapshot(response.getOutputStream(), def, link, snapshotDetail, snapshotConnectionId); ! } else if (tab.equals(TAB_STATISTICS)) { doStatistics(response.getOutputStream(), statisticsArray, def); } else { *************** *** 204,208 **** } - } --- 204,207 ---- *************** *** 219,223 **** } - private void doStatistics(ServletOutputStream out, StatisticsIF[] statisticsArray, ConnectionPoolDefinitionIF cpd) throws IOException { --- 218,221 ---- *************** *** 227,230 **** --- 225,230 ---- openDataTable(out); + printDefinitionEntry(out, ProxoolConstants.ALIAS, cpd.getAlias(), CORE_PROPERTY); + // Period printDefinitionEntry(out, "Period", TIME_FORMAT.format(statistics.getStartDate()) + " to " + TIME_FORMAT.format(statistics.getStopDate()), STATISTIC); *************** *** 333,339 **** } ! private void doSnapshot(ServletOutputStream out, String alias, String link, String level, String connectionId) throws IOException, ProxoolException { boolean detail = (level != null && level.equals(DETAIL_MORE)); ! SnapshotIF snapshot = ProxoolFacade.getSnapshot(alias, detail); if (snapshot != null) { --- 333,339 ---- } ! private void doSnapshot(ServletOutputStream out, ConnectionPoolDefinitionIF cpd, String link, String level, String connectionId) throws IOException, ProxoolException { boolean detail = (level != null && level.equals(DETAIL_MORE)); ! SnapshotIF snapshot = ProxoolFacade.getSnapshot(cpd.getAlias(), detail); if (snapshot != null) { *************** *** 341,344 **** --- 341,346 ---- openDataTable(out); + printDefinitionEntry(out, ProxoolConstants.ALIAS, cpd.getAlias(), CORE_PROPERTY); + // dateStarted printDefinitionEntry(out, "Start date", DATE_FORMAT.format(snapshot.getDateStarted()), SNAPSHOT); *************** *** 361,365 **** String[] colours = {"ff9999", "66cc66", "cccccc"}; int[] lengths = {snapshot.getActiveConnectionCount(), snapshot.getAvailableConnectionCount(), ! snapshot.getMaximumConnectionCount() - snapshot.getActiveConnectionCount() - snapshot.getAvailableConnectionCount()}; drawBarChart(connectionsBuffer, colours, lengths); printDefinitionEntry(out, "Connections", connectionsBuffer.toString(), SNAPSHOT); --- 363,367 ---- String[] colours = {"ff9999", "66cc66", "cccccc"}; int[] lengths = {snapshot.getActiveConnectionCount(), snapshot.getAvailableConnectionCount(), ! snapshot.getMaximumConnectionCount() - snapshot.getActiveConnectionCount() - snapshot.getAvailableConnectionCount()}; drawBarChart(connectionsBuffer, colours, lengths); printDefinitionEntry(out, "Connections", connectionsBuffer.toString(), SNAPSHOT); *************** *** 374,378 **** out.println(" <tr>"); out.print(" <td colspan=\"2\" align=\"right\"><form action=\"" + link + "\" method=\"GET\">"); ! out.print("<input type=\"hidden\" name=\"" + ALIAS + "\" value=\"" + alias + "\">"); out.print("<input type=\"hidden\" name=\"" + TAB + "\" value=\"" + TAB_SNAPSHOT + "\">"); out.print("<input type=\"hidden\" name=\"" + DETAIL + "\" value=\"" + DETAIL_MORE + "\">"); --- 376,380 ---- out.println(" <tr>"); out.print(" <td colspan=\"2\" align=\"right\"><form action=\"" + link + "\" method=\"GET\">"); ! out.print("<input type=\"hidden\" name=\"" + ALIAS + "\" value=\"" + cpd.getAlias() + "\">"); out.print("<input type=\"hidden\" name=\"" + TAB + "\" value=\"" + TAB_SNAPSHOT + "\">"); out.print("<input type=\"hidden\" name=\"" + DETAIL + "\" value=\"" + DETAIL_MORE + "\">"); *************** *** 388,392 **** out.print(" <td>"); ! doSnapshotDetails(out, alias, snapshot, link, connectionId); out.println("</td>"); --- 390,394 ---- out.print(" <td>"); ! doSnapshotDetails(out, cpd, snapshot, link, connectionId); out.println("</td>"); *************** *** 413,417 **** out.println(" <tr>"); out.print(" <td colspan=\"2\" align=\"right\"><form action=\"" + link + "\" method=\"GET\">"); ! out.print("<input type=\"hidden\" name=\"" + ALIAS + "\" value=\"" + alias + "\">"); out.print("<input type=\"hidden\" name=\"" + TAB + "\" value=\"" + TAB_SNAPSHOT + "\">"); out.print("<input type=\"hidden\" name=\"" + DETAIL + "\" value=\"" + DETAIL_LESS + "\">"); --- 415,419 ---- out.println(" <tr>"); out.print(" <td colspan=\"2\" align=\"right\"><form action=\"" + link + "\" method=\"GET\">"); ! out.print("<input type=\"hidden\" name=\"" + ALIAS + "\" value=\"" + cpd.getAlias() + "\">"); out.print("<input type=\"hidden\" name=\"" + TAB + "\" value=\"" + TAB_SNAPSHOT + "\">"); out.print("<input type=\"hidden\" name=\"" + DETAIL + "\" value=\"" + DETAIL_LESS + "\">"); *************** *** 425,429 **** } ! private void doSnapshotDetails(ServletOutputStream out, String alias, SnapshotIF snapshot, String link, String connectionId) throws IOException { long drillDownConnectionId = 0; --- 427,431 ---- } ! private void doSnapshotDetails(ServletOutputStream out, ConnectionPoolDefinitionIF cpd, SnapshotIF snapshot, String link, String connectionId) throws IOException { long drillDownConnectionId = 0; *************** *** 474,478 **** out.print(ALIAS); out.print("="); ! out.print(alias); out.print("&"); out.print(TAB); --- 476,480 ---- out.print(ALIAS); out.print("="); ! out.print(cpd.getAlias()); out.print("&"); out.print(TAB); *************** *** 573,599 **** private void openHtml(ServletOutputStream out) throws IOException { out.println("<html><header><title>Proxool Admin</title>"); if (cssFile != null) { ! out.println("<script type=\"text/css\" src=\"" + cssFile + "\"></script>"); ! } else { ! out.println("<style>"); ! out.println("body {background-color: #93bde6;}\n" + ! "div.version {font-weight: bold; font-size: 100%; margin-bottom: 8px;}\n" + ! "h1 {font-weight: bold; font-size: 100%}\n" + ! "table.data {font-size: 90%; border-collapse: collapsed; border: 1px solid black;}\n" + ! "table.data th {background: #bddeff; width: 20em; text-align: left; padding-right: 8px; font-weight: normal;}\n" + ! "table.data td {background: #ffffff; vertical-align: top; padding: 0px 2px 0px 2px;}\n" + ! "td.null {background: yellow;}\n" + ! "td.available {font-color: black;}\n" + ! "td.active {font-color: red;}\n" + ! "td.offline {font-color: blue;}\n" + ! "div.drill-down {}\n" + ! "ul {list-style: none; padding: 0px; margin: 0px; position: relative;}\n" + ! "li {padding: 0px; margin: 0px 4px 0px 0px; display: inline; border: 1px solid black; border-width: 1px 1px 0px 1px;}\n" + ! "li.active {background: #bddeff;}\n" + ! "li.inactive {background: #eeeeee;}\n" + ! "li.disabled {background: #dddddd; color: #999999; padding: 0px 4px 0px 4px;}\n" + ! "a.quiet {color: black; text-decoration: none; padding: 0px 4px 0px 4px; }\n" + ! "a.quiet:hover {background: white;}\n"); ! out.println("</style>"); } out.println("</header><body>"); --- 575,603 ---- private void openHtml(ServletOutputStream out) throws IOException { out.println("<html><header><title>Proxool Admin</title>"); + out.println("<style media=\"screen\">"); + out.println("body {background-color: #93bde6;}\n" + + "div.version {font-weight: bold; font-size: 100%; margin-bottom: 8px;}\n" + + "h1 {font-weight: bold; font-size: 100%}\n" + + "option {padding: 2px 24px 2px 4px;}\n" + + "input {margin: 0px 0px 4px 12px;}\n" + + "table.data {font-size: 90%; border-collapse: collapse; border: 1px solid black;}\n" + + "table.data th {background: #bddeff; width: 25em; text-align: left; padding-right: 8px; font-weight: normal; border: 1px solid black;}\n" + + "table.data td {background: #ffffff; vertical-align: top; padding: 0px 2px 0px 2px; border: 1px solid black;}\n" + + "td.null {background: yellow;}\n" + + "td.available {color: black;}\n" + + "td.active {color: red;}\n" + + "td.offline {color: blue;}\n" + + "div.drill-down {}\n" + + "ul {list-style: none; padding: 0px; margin: 0px; position: relative; font-size: 90%;}\n" + + "li {padding: 0px; margin: 0px 4px 0px 0px; display: inline; border: 1px solid black; border-width: 1px 1px 0px 1px;}\n" + + "li.active {background: #bddeff;}\n" + + "li.inactive {background: #eeeeee;}\n" + + "li.disabled {background: #dddddd; color: #999999; padding: 0px 4px 0px 4px;}\n" + + "a.quiet {color: black; text-decoration: none; padding: 0px 4px 0px 4px; }\n" + + "a.quiet:hover {background: white;}\n"); + out.println("</style>"); + // If we have configured a cssFile then that will override what we have above if (cssFile != null) { ! out.println("<link rel=\"stylesheet\" media=\"screen\" type=\"text/css\" href=\"" + cssFile + "\"></script>"); } out.println("</header><body>"); *************** *** 615,619 **** } - private void printDefinitionEntry(ServletOutputStream out, String name, String value, String type) throws IOException { out.println(" <tr>"); --- 619,622 ---- *************** *** 660,663 **** --- 663,667 ---- /** * Express time in an easy to read HH:mm:ss format + * * @param time in milliseconds * @return time (e.g. 180000 = 00:30:00) *************** *** 672,745 **** } - /* ! Revision history: ! $Log$ ! Revision 1.10 2005/09/26 21:47:46 billhorsman ! no message ! Revision 1.9 2005/09/26 13:31:14 billhorsman ! Smartened up AdminServlet ! Revision 1.8 2003/09/29 17:49:19 billhorsman ! Includes new fatal-sql-exception-wrapper-class in display ! Revision 1.7 2003/08/06 20:08:58 billhorsman ! fix timezone display of time (for millisecond based properties) ! Revision 1.6 2003/03/10 23:43:14 billhorsman ! reapplied checkstyle that i'd inadvertently let ! IntelliJ change... ! Revision 1.5 2003/03/10 15:26:51 billhorsman ! refactoringn of concurrency stuff (and some import ! optimisation) ! Revision 1.4 2003/03/03 11:12:00 billhorsman ! fixed licence ! Revision 1.3 2003/02/26 16:59:18 billhorsman ! fixed spelling error in method name ! Revision 1.2 2003/02/26 16:51:12 billhorsman ! fixed units for average active time. now displays ! properly in seconds ! Revision 1.1 2003/02/24 10:19:44 billhorsman ! moved AdminServlet into servlet package ! Revision 1.1 2003/02/19 23:36:51 billhorsman ! renamed monitor package to admin ! Revision 1.10 2003/02/12 12:28:27 billhorsman ! added url, proxyHashcode and delegateHashcode to ! ConnectionInfoIF ! Revision 1.9 2003/02/11 00:30:28 billhorsman ! add version ! Revision 1.8 2003/02/06 17:41:05 billhorsman ! now uses imported logging ! Revision 1.7 2003/02/06 15:42:21 billhorsman ! display changes ! Revision 1.6 2003/02/05 17:04:02 billhorsman ! fixed date format ! Revision 1.5 2003/02/05 15:06:16 billhorsman ! removed dependency on JDK1.4 imaging. ! Revision 1.4 2003/01/31 16:53:21 billhorsman ! checkstyle ! Revision 1.3 2003/01/31 16:38:52 billhorsman ! doc (and removing public modifier for classes where possible) ! Revision 1.2 2003/01/31 11:35:57 billhorsman ! improvements to servlet (including connection details) ! Revision 1.1 2003/01/31 00:38:22 billhorsman ! *** empty log message *** ! */ \ No newline at end of file --- 676,751 ---- } /* ! Revision history: ! $Log$ ! Revision 1.11 2005/10/02 09:45:49 billhorsman ! Layout ! Revision 1.10 2005/09/26 21:47:46 billhorsman ! no message ! Revision 1.9 2005/09/26 13:31:14 billhorsman ! Smartened up AdminServlet ! Revision 1.8 2003/09/29 17:49:19 billhorsman ! Includes new fatal-sql-exception-wrapper-class in display ! Revision 1.7 2003/08/06 20:08:58 billhorsman ! fix timezone display of time (for millisecond based properties) ! Revision 1.6 2003/03/10 23:43:14 billhorsman ! reapplied checkstyle that i'd inadvertently let ! IntelliJ change... ! Revision 1.5 2003/03/10 15:26:51 billhorsman ! refactoringn of concurrency stuff (and some import ! optimisation) ! Revision 1.4 2003/03/03 11:12:00 billhorsman ! fixed licence ! Revision 1.3 2003/02/26 16:59:18 billhorsman ! fixed spelling error in method name ! Revision 1.2 2003/02/26 16:51:12 billhorsman ! fixed units for average active time. now displays ! properly in seconds ! Revision 1.1 2003/02/24 10:19:44 billhorsman ! moved AdminServlet into servlet package ! Revision 1.1 2003/02/19 23:36:51 billhorsman ! renamed monitor package to admin ! Revision 1.10 2003/02/12 12:28:27 billhorsman ! added url, proxyHashcode and delegateHashcode to ! ConnectionInfoIF ! Revision 1.9 2003/02/11 00:30:28 billhorsman ! add version ! Revision 1.8 2003/02/06 17:41:05 billhorsman ! now uses imported logging ! Revision 1.7 2003/02/06 15:42:21 billhorsman ! display changes ! Revision 1.6 2003/02/05 17:04:02 billhorsman ! fixed date format ! Revision 1.5 2003/02/05 15:06:16 billhorsman ! removed dependency on JDK1.4 imaging. ! Revision 1.4 2003/01/31 16:53:21 billhorsman ! checkstyle ! Revision 1.3 2003/01/31 16:38:52 billhorsman ! doc (and removing public modifier for classes where possible) ! Revision 1.2 2003/01/31 11:35:57 billhorsman ! improvements to servlet (including connection details) ! Revision 1.1 2003/01/31 00:38:22 billhorsman ! *** empty log message *** ! ! */ \ No newline at end of file |
From: <bil...@us...> - 2005-10-02 21:11:47
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11905/src/java/org/logicalcobwebs/proxool Modified Files: HouseKeeper.java Log Message: Improve message when closing a connection that has been active for too long Index: HouseKeeper.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/HouseKeeper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HouseKeeper.java 11 Sep 2003 23:57:48 -0000 1.3 --- HouseKeeper.java 2 Oct 2005 12:35:06 -0000 1.4 *************** *** 139,146 **** connectionPool.removeProxyConnection(proxyConnection, "it has been active for too long", ConnectionPool.FORCE_EXPIRY, true); ! log.warn("#" + FormatHelper.formatMediumNumber(proxyConnection.getId()) + " was active for " + activeTime + " milliseconds and has been removed automaticaly. The Thread responsible was named '" ! + proxyConnection.getRequester() + "'."); } --- 139,153 ---- connectionPool.removeProxyConnection(proxyConnection, "it has been active for too long", ConnectionPool.FORCE_EXPIRY, true); ! String lastSqlCallMsg; ! if (proxyConnection.getLastSqlCall() != null) { ! lastSqlCallMsg = ", and the last SQL it performed is '" + proxyConnection.getLastSqlCall() + "'."; ! } else if (!proxyConnection.getDefinition().isTrace()) { ! lastSqlCallMsg = ", but the last SQL it performed is unknown because the trace property is not enabled."; ! } else { ! lastSqlCallMsg = ", but the last SQL it performed is unknown."; ! } log.warn("#" + FormatHelper.formatMediumNumber(proxyConnection.getId()) + " was active for " + activeTime + " milliseconds and has been removed automaticaly. The Thread responsible was named '" ! + proxyConnection.getRequester() + "'" + lastSqlCallMsg); } *************** *** 253,256 **** --- 260,266 ---- Revision history: $Log$ + Revision 1.4 2005/10/02 12:35:06 billhorsman + Improve message when closing a connection that has been active for too long + Revision 1.3 2003/09/11 23:57:48 billhorsman Test SQL now traps Throwable, not just SQLException. |
From: <bil...@us...> - 2005-10-02 19:46:37
|
Update of /cvsroot/proxool/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6962 Modified Files: CHANGES.txt Log Message: Draft Index: CHANGES.txt =================================================================== RCS file: /cvsroot/proxool/proxool/CHANGES.txt,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** CHANGES.txt 17 Jun 2004 21:59:07 -0000 1.37 --- CHANGES.txt 2 Oct 2005 15:01:04 -0000 1.38 *************** *** 8,16 **** 0.9.0 ! - New DataSource implementation. TODO more - All connections are now wrapped in disposable wrappers. This means that once you have closed a connection (thereby returning it to the pool) you can no longer do anything to it that ! might influence its behaviour for the next client that picks it up. - Connections, Statements, PreparedStatements, and CallableStatements now implement --- 8,20 ---- 0.9.0 ! - New DataSource implementation. This has been tested with Tomcat 5.5. DataSource configuration ! is so specific to the container that it is safer to only state where it has been tested. We ! have no reason to suspect that it would not work in other containers. - All connections are now wrapped in disposable wrappers. This means that once you have closed a connection (thereby returning it to the pool) you can no longer do anything to it that ! might influence its behaviour for the next client that picks it up. It also means that if ! a connection is closed automatically by Proxool then the client gets an exception if it tries ! to do anything other than call close() or isClosed(). - Connections, Statements, PreparedStatements, and CallableStatements now implement *************** *** 41,44 **** --- 45,55 ---- output during testing when we encounter *expected* errors). + - AdminServlet has been updated. Nicer layout. Separate tabs for definition, snapshot and statistics. + Uses a list box for aliases in case there are a lot. + + - When you ask for a detailed snapshot (see ProxoolFacade.getSnapshot()) then it only attempts to + get one for 10 seconds before giving up. A detailed snapshot needs to get a lock on the pool + concerned and if the pool is really busy that might take a while. Belt and braces really. + 0.8.3 - 14 December 2003 |
From: <bil...@us...> - 2005-10-02 19:18:39
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11492/src/java/org/logicalcobwebs/proxool Modified Files: WrappedConnection.java Log Message: Improve the trapping of operations after a wrapped connection is closed. Index: WrappedConnection.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/WrappedConnection.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** WrappedConnection.java 4 May 2005 16:31:41 -0000 1.4 --- WrappedConnection.java 2 Oct 2005 12:32:58 -0000 1.5 *************** *** 54,57 **** --- 54,65 ---- private String alias; + + /** + * This gets set if the close() method is explicitly called. The {@link #getProxyConnection() proxyConnection} + * could still be {@link org.logicalcobwebs.proxool.ProxyConnectionIF#isReallyClosed() really closed} without + * this wrapper knowing about it yet. + */ + private boolean manuallyClosed; + /** * Construct this wrapper around the proxy connection *************** *** 104,114 **** } try { if (concreteMethod.getName().equals(CLOSE_METHOD)) { // It's okay to close a connection twice. Only we ignore the // second time. ! if (proxyConnection != null) { proxyConnection.close(); // Set it to null so that we can't do anything else to it. proxyConnection = null; } } else if (concreteMethod.getName().equals(EQUALS_METHOD) && argCount == 1) { --- 112,139 ---- } try { + if (proxyConnection != null && proxyConnection.isReallyClosed()) { + // The user is trying to do something to this connection and it's been closed. + if (concreteMethod.getName().equals(IS_CLOSED_METHOD)) { + // That's cool. No problem checking as many times as you like. + } else if (concreteMethod.getName().equals(CLOSE_METHOD)) { + // That's cool. You can call close as often as you like. + } else if (manuallyClosed) { + // We've already manually closed this connection yet we trying to do something + // to it that isn't another close(). That is bad client coding :) + throw new SQLException("You can't perform any operations on a connection after you've called close()"); + } else { + // The connection has been closed automatically. The client probably wasn't expecting + // that. Still, throw an exception so that they know it's all gone pear shaped. + throw new SQLException("You can't perform any operations on this connection. It has been automatically closed by Proxool for some reason (see logs)."); + } + } if (concreteMethod.getName().equals(CLOSE_METHOD)) { // It's okay to close a connection twice. Only we ignore the // second time. ! if (proxyConnection != null && !proxyConnection.isReallyClosed()) { proxyConnection.close(); // Set it to null so that we can't do anything else to it. proxyConnection = null; + manuallyClosed = true; } } else if (concreteMethod.getName().equals(EQUALS_METHOD) && argCount == 1) { *************** *** 180,184 **** throw e.getTargetException(); } catch (SQLException e) { ! throw new SQLException("Couldn't perform the operation " + concreteMethod.getName()); } catch (Exception e) { LOG.error("Unexpected invocation exception", e); --- 205,209 ---- throw e.getTargetException(); } catch (SQLException e) { ! throw new SQLException("Couldn't perform the operation " + concreteMethod.getName() + ": " + e.getMessage()); } catch (Exception e) { LOG.error("Unexpected invocation exception", e); *************** *** 242,245 **** --- 267,273 ---- Revision history: $Log$ + Revision 1.5 2005/10/02 12:32:58 billhorsman + Improve the trapping of operations after a wrapped connection is closed. + Revision 1.4 2005/05/04 16:31:41 billhorsman Use the definition referenced by the proxy connection rather than the pool instead. |
From: <bil...@us...> - 2005-09-26 21:47:56
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin/servlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1469/src/java/org/logicalcobwebs/proxool/admin/servlet Modified Files: AdminServlet.java Log Message: no message Index: AdminServlet.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin/servlet/AdminServlet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AdminServlet.java 26 Sep 2005 13:31:14 -0000 1.9 --- AdminServlet.java 26 Sep 2005 21:47:46 -0000 1.10 *************** *** 581,586 **** "h1 {font-weight: bold; font-size: 100%}\n" + "table.data {font-size: 90%; border-collapse: collapsed; border: 1px solid black;}\n" + ! "table.data th {background: #bddeff; width: 200px; text-align: left; padding-right: 8px; font-weight: normal;}\n" + ! "table.data td {background: #ffffff; vertical-align: top;}\n" + "td.null {background: yellow;}\n" + "td.available {font-color: black;}\n" + --- 581,586 ---- "h1 {font-weight: bold; font-size: 100%}\n" + "table.data {font-size: 90%; border-collapse: collapsed; border: 1px solid black;}\n" + ! "table.data th {background: #bddeff; width: 20em; text-align: left; padding-right: 8px; font-weight: normal;}\n" + ! "table.data td {background: #ffffff; vertical-align: top; padding: 0px 2px 0px 2px;}\n" + "td.null {background: yellow;}\n" + "td.available {font-color: black;}\n" + *************** *** 676,679 **** --- 676,682 ---- Revision history: $Log$ + Revision 1.10 2005/09/26 21:47:46 billhorsman + no message + Revision 1.9 2005/09/26 13:31:14 billhorsman Smartened up AdminServlet |