[Proxool-cvs] proxool/src/java/org/logicalcobwebs/proxool Prototyper.java,1.9,1.10
UNMAINTAINED!
Brought to you by:
billhorsman
From: <bil...@us...> - 2005-05-04 16:28:03
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9422/src/java/org/logicalcobwebs/proxool Modified Files: Prototyper.java Log Message: Check to see whether a new connection was really added to the pool. Index: Prototyper.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/Prototyper.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Prototyper.java 25 Mar 2004 22:02:15 -0000 1.9 --- Prototyper.java 4 May 2005 16:27:54 -0000 1.10 *************** *** 156,160 **** try { // get a new *real* connection ! realConnection = connectionBuilder.buildConnection(connectionPool.getDefinition()); // build a proxy around it --- 156,161 ---- try { // get a new *real* connection ! final ConnectionPoolDefinition definition = connectionPool.getDefinition(); ! realConnection = connectionBuilder.buildConnection(definition); // build a proxy around it *************** *** 164,169 **** // The ProxyConnection is passed the ConnectionPoolDefinition as well so it doesn't // need the url in its constructor... ! String url = connectionPool.getDefinition().getUrl(); ! proxyConnection = new ProxyConnection(realConnection, id, url, connectionPool, status); try { --- 165,170 ---- // The ProxyConnection is passed the ConnectionPoolDefinition as well so it doesn't // need the url in its constructor... ! String url = definition.getUrl(); ! proxyConnection = new ProxyConnection(realConnection, id, url, connectionPool, definition, status); try { *************** *** 179,184 **** // ConnectionPool maintains the pool and its integrity, the Prototyper creates new // connections when instructed. ! connectionPool.addProxyConnection(proxyConnection); ! if (log.isDebugEnabled()) { StringBuffer out = new StringBuffer(connectionPool.displayStatistics()); --- 180,184 ---- // ConnectionPool maintains the pool and its integrity, the Prototyper creates new // connections when instructed. ! boolean added = connectionPool.addProxyConnection(proxyConnection); if (log.isDebugEnabled()) { StringBuffer out = new StringBuffer(connectionPool.displayStatistics()); *************** *** 203,207 **** --- 203,218 ---- } log.debug(out); + if (!added) { + out = new StringBuffer(connectionPool.displayStatistics()); + out.append(" - Connection #"); + out.append(proxyConnection.getId()); + out.append(" has been discarded immediately because the definition it was built with is out of date"); + log.debug(out); + } + } + if (!added) { + proxyConnection.reallyClose(); } + } catch (SQLException e) { // log.error(displayStatistics() + " - Couldn't initialise connection #" + proxyConnection.getId() + ": " + e); *************** *** 291,296 **** Revision history: $Log$ Revision 1.9 2004/03/25 22:02:15 brenuart ! First step towards pluggable ConnectionBuilderIF & ConnectionValidatorIF. Include some minor refactoring that lead to deprecation of some PrototyperController methods. --- 302,310 ---- Revision history: $Log$ + Revision 1.10 2005/05/04 16:27:54 billhorsman + Check to see whether a new connection was really added to the pool. + Revision 1.9 2004/03/25 22:02:15 brenuart ! First step towards pluggable ConnectionBuilderIF & ConnectionValidatorIF. Include some minor refactoring that lead to deprecation of some PrototyperController methods. |