proxool-cvs Mailing List for Proxool: Proxy JDBC Connection Pool (Page 5)
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...> - 2004-06-17 21:59:17
|
Update of /cvsroot/proxool/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11976 Modified Files: CHANGES.txt Log Message: Draft Index: CHANGES.txt =================================================================== RCS file: /cvsroot/proxool/proxool/CHANGES.txt,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** CHANGES.txt 2 Jun 2004 21:13:40 -0000 1.36 --- CHANGES.txt 17 Jun 2004 21:59:07 -0000 1.37 *************** *** 20,23 **** --- 20,30 ---- into an interface - concrete classes aren't supported at this time. + - You can now inject interfaces for proxied objects that expose public methods that aren't + declared in an interface. So if your vendor Connection, Statement, PreparedStatement or + CallableStatement have any public methods that aren't declared in an interface (and therefore + not exposed automatically) you can just write your own interface that declares the same + signature. Even though the vendor object doesn't implement your interface directly, the + proxied object will behave as if it does. + - ProxoolFacade now has killConnection that accepts the Connection object itself, so you don't have to know the pool alias and connection ID. |
From: <bil...@us...> - 2004-06-17 21:58:46
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11648/src/java/org/logicalcobwebs/proxool Modified Files: ProxyFactory.java Log Message: Injectable interface fixes. Index: ProxyFactory.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxyFactory.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ProxyFactory.java 2 Jun 2004 20:50:47 -0000 1.27 --- ProxyFactory.java 17 Jun 2004 21:58:36 -0000 1.28 *************** *** 125,128 **** --- 125,131 ---- */ private static Class[] getInterfaces(Class clazz, ConnectionPool connectionPool) { + if (LOG.isDebugEnabled()) { + LOG.debug("Looking up injectable interfaces for " + clazz); + } Class[] interfaceArray = (Class[]) interfaceMap.get(clazz); if (interfaceArray == null) { *************** *** 133,153 **** // we check CallableStatement then PreparedStatement then Statement or all three will get // caught by Statement - Class injectableClass = null; if (Connection.class.isAssignableFrom(clazz)) { ! injectableClass = connectionPool.getDefinition().getInjectableConnectionInterface(); ! } else if (CallableStatement.class.isAssignableFrom(clazz)) { ! injectableClass = connectionPool.getDefinition().getInjectableCallableStatementInterface(); ! } else if (PreparedStatement.class.isAssignableFrom(clazz)) { ! injectableClass = connectionPool.getDefinition().getInjectablePreparedStatementInterface(); ! } else if (Statement.class.isAssignableFrom(clazz)) { ! injectableClass = connectionPool.getDefinition().getInjectableStatementInterface(); } ! // Inject it if it was configured. ! if (injectableClass != null) { ! interfaces.add(injectableClass); } } interfaceArray = (Class[]) interfaces.toArray(new Class[interfaces.size()]); - /* if (LOG.isDebugEnabled()) { for (int i = 0; i < interfaceArray.length; i++) { --- 136,184 ---- // we check CallableStatement then PreparedStatement then Statement or all three will get // caught by Statement if (Connection.class.isAssignableFrom(clazz)) { ! Class injectableClass = connectionPool.getDefinition().getInjectableConnectionInterface(); ! // Inject it if it was configured. ! if (injectableClass != null) { ! interfaces.add(injectableClass); ! if (LOG.isDebugEnabled()) { ! LOG.debug("Injecting " + injectableClass + " into " + clazz); ! } ! } } ! if (CallableStatement.class.isAssignableFrom(clazz)) { ! if (LOG.isDebugEnabled()) { ! LOG.debug("Getting injectableCallableStatementInterface"); ! } ! Class injectableClass = connectionPool.getDefinition().getInjectableCallableStatementInterface(); ! // Inject it if it was configured. ! if (injectableClass != null) { ! interfaces.add(injectableClass); ! if (LOG.isDebugEnabled()) { ! LOG.debug("Injecting " + injectableClass + " into " + clazz); ! } ! } ! } ! if (PreparedStatement.class.isAssignableFrom(clazz)) { ! Class injectableClass = connectionPool.getDefinition().getInjectablePreparedStatementInterface(); ! // Inject it if it was configured. ! if (injectableClass != null) { ! interfaces.add(injectableClass); ! if (LOG.isDebugEnabled()) { ! LOG.debug("Injecting " + injectableClass + " into " + clazz); ! } ! } ! } ! if (Statement.class.isAssignableFrom(clazz)) { ! Class injectableClass = connectionPool.getDefinition().getInjectableStatementInterface(); ! // Inject it if it was configured. ! if (injectableClass != null) { ! interfaces.add(injectableClass); ! if (LOG.isDebugEnabled()) { ! LOG.debug("Injecting " + injectableClass + " into " + clazz); ! } ! } } } interfaceArray = (Class[]) interfaces.toArray(new Class[interfaces.size()]); if (LOG.isDebugEnabled()) { for (int i = 0; i < interfaceArray.length; i++) { *************** *** 156,160 **** } } - */ interfaceMap.put(clazz, interfaceArray); /* --- 187,190 ---- *************** *** 260,263 **** --- 290,296 ---- Revision history: $Log$ + Revision 1.28 2004/06/17 21:58:36 billhorsman + Injectable interface fixes. + Revision 1.27 2004/06/02 20:50:47 billhorsman Dropped obsolete InvocationHandler reference and injectable interface stuff. |
From: <bil...@us...> - 2004-06-17 21:57:02
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10439/src/java/org/logicalcobwebs/proxool Modified Files: ProxyStatement.java Log Message: Use MethodMapper for concrete methods. Index: ProxyStatement.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxyStatement.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ProxyStatement.java 2 Jun 2004 20:48:14 -0000 1.26 --- ProxyStatement.java 17 Jun 2004 21:56:53 -0000 1.27 *************** *** 12,15 **** --- 12,16 ---- import org.logicalcobwebs.cglib.proxy.MethodProxy; import org.logicalcobwebs.cglib.proxy.InvocationHandler; + import org.logicalcobwebs.proxool.proxy.InvokerFacade; import java.lang.reflect.InvocationTargetException; *************** *** 57,70 **** final int argCount = args != null ? args.length : 0; // We need to remember an exceptions that get thrown so that we can optionally // pass them to the onExecute() call below Exception exception = null; try { ! if (method.getName().equals(EQUALS_METHOD) && argCount == 1) { result = new Boolean(equals(args[0])); ! } else if (method.getName().equals(CLOSE_METHOD) && argCount == 0) { close(); } else { ! result = method.invoke(getStatement(), args); } --- 58,72 ---- final int argCount = args != null ? args.length : 0; + Method concreteMethod = InvokerFacade.getConcreteMethod(getStatement().getClass(), method); // We need to remember an exceptions that get thrown so that we can optionally // pass them to the onExecute() call below Exception exception = null; 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 { ! result = concreteMethod.invoke(getStatement(), args); } *************** *** 74,81 **** // What sort of method is it ! if (method.getName().equals(SET_NULL_METHOD) && argCount > 0 && args[0] instanceof Integer) { int index = ((Integer) args[0]).intValue(); putParameter(index, null); ! } else if (method.getName().startsWith(SET_PREFIX) && argCount > 1 && args[0] instanceof Integer) { int index = ((Integer) args[0]).intValue(); putParameter(index, args[1]); --- 76,83 ---- // What sort of method is it ! if (concreteMethod.getName().equals(SET_NULL_METHOD) && argCount > 0 && args[0] instanceof Integer) { int index = ((Integer) args[0]).intValue(); putParameter(index, null); ! } else if (concreteMethod.getName().startsWith(SET_PREFIX) && argCount > 1 && args[0] instanceof Integer) { int index = ((Integer) args[0]).intValue(); putParameter(index, args[1]); *************** *** 107,111 **** } finally { ! if (method.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) { --- 109,113 ---- } 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) { *************** *** 113,120 **** } appendToSqlLog(); ! } else if (method.getName().equals(EXECUTE_BATCH_METHOD)) { // executing a batch should do a trace trace(startTime, exception); ! } else if (method.getName().startsWith(EXECUTE_FRAGMENT)) { // executing should update the log and do a trace if (argCount > 0 && args[0] instanceof String) { --- 115,122 ---- } 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) { *************** *** 136,139 **** --- 138,144 ---- Revision history: $Log$ + Revision 1.27 2004/06/17 21:56:53 billhorsman + Use MethodMapper for concrete methods. + Revision 1.26 2004/06/02 20:48:14 billhorsman Dropped obsolete InvocationHandler reference. |
From: <bil...@us...> - 2004-06-17 21:40:15
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/cglib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32628/src/java-test/org/logicalcobwebs/cglib Modified Files: MyConcreteClass.java Log Message: Log message should be debug not error Index: MyConcreteClass.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/cglib/MyConcreteClass.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MyConcreteClass.java 2 Jun 2004 20:54:57 -0000 1.1 --- MyConcreteClass.java 17 Jun 2004 21:40:06 -0000 1.2 *************** *** 8,12 **** import org.logicalcobwebs.logging.Log; import org.logicalcobwebs.logging.LogFactory; - import org.logicalcobwebs.proxool.WrappedConnection; /** --- 8,11 ---- *************** *** 21,25 **** MyConcreteClass() { ! LOG.error("MyConcreteClass.init"); } --- 20,24 ---- MyConcreteClass() { ! LOG.debug("MyConcreteClass.init"); } *************** *** 35,38 **** --- 34,40 ---- Revision history: $Log$ + Revision 1.2 2004/06/17 21:40:06 billhorsman + Log message should be debug not error + Revision 1.1 2004/06/02 20:54:57 billhorsman Learning test class for Enhancer. It fails (or would if the assert was uncommented). Left in for knowledge. |
From: <bil...@us...> - 2004-06-17 21:36:48
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29703/src/java-test/org/logicalcobwebs/proxool Modified Files: InjectableInterfaceTest.java Log Message: Removed call to private methods. They're going to fail anyway. Index: InjectableInterfaceTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/InjectableInterfaceTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InjectableInterfaceTest.java 2 Jun 2004 20:59:52 -0000 1.1 --- InjectableInterfaceTest.java 17 Jun 2004 21:36:39 -0000 1.2 *************** *** 6,9 **** --- 6,12 ---- package org.logicalcobwebs.proxool; + import org.logicalcobwebs.logging.Log; + import org.logicalcobwebs.logging.LogFactory; + import java.util.Properties; import java.sql.Connection; *************** *** 22,25 **** --- 25,30 ---- public class InjectableInterfaceTest extends AbstractProxoolTest { + private static final Log LOG = LogFactory.getLog(InjectableInterfaceTest.class); + /** * @see AbstractProxoolTest *************** *** 44,49 **** // Can we cast it? HsqlConnectionIF hc = (HsqlConnectionIF) c1; ! // Can we call one of vendor specific methods? ! hc.checkClosed(); // Does close() still work? hc.close(); --- 49,53 ---- // Can we cast it? HsqlConnectionIF hc = (HsqlConnectionIF) c1; ! // TODO - need to test a vendor specific method? // Does close() still work? hc.close(); *************** *** 62,72 **** info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER); info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); ! info.setProperty(ProxoolConstants.INJECTABLE_STATEMENT_INTERFACE_NAME_PROPERTY, HsqlConnectionIF.class.getName()); Connection c1 = DriverManager.getConnection(url, info); Statement s = c1.createStatement(); // Can we cast it? HsqlStatementIF hs = (HsqlStatementIF) s; ! // Can we call one of vendor specific methods? ! hs.checkClosed(); // Does close() still work? hs.close(); --- 66,76 ---- info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER); info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); ! info.setProperty(ProxoolConstants.INJECTABLE_STATEMENT_INTERFACE_NAME_PROPERTY, HsqlStatementIF.class.getName()); Connection c1 = DriverManager.getConnection(url, info); Statement s = c1.createStatement(); // Can we cast it? HsqlStatementIF hs = (HsqlStatementIF) s; ! // TODO : call a vendor specific method? ! // hs.checkClosed(); // Does close() still work? hs.close(); *************** *** 85,95 **** info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER); info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); ! info.setProperty(ProxoolConstants.INJECTABLE_STATEMENT_INTERFACE_NAME_PROPERTY, HsqlConnectionIF.class.getName()); Connection c1 = DriverManager.getConnection(url, info); PreparedStatement ps = c1.prepareStatement(TestConstants.HYPERSONIC_TEST_SQL); // Can we cast it? HsqlPreparedStatementIF hps = (HsqlPreparedStatementIF) ps; ! // Can we call one of vendor specific methods? ! hps.build(); // Does close() still work? hps.close(); --- 89,99 ---- info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER); info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); ! info.setProperty(ProxoolConstants.INJECTABLE_PREPARED_STATEMENT_INTERFACE_NAME_PROPERTY, HsqlPreparedStatementIF.class.getName()); Connection c1 = DriverManager.getConnection(url, info); PreparedStatement ps = c1.prepareStatement(TestConstants.HYPERSONIC_TEST_SQL); // Can we cast it? HsqlPreparedStatementIF hps = (HsqlPreparedStatementIF) ps; ! // TODO : call a vendor specific method? ! // hps.build(); // Does close() still work? hps.close(); *************** *** 108,118 **** info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER); info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); ! info.setProperty(ProxoolConstants.INJECTABLE_STATEMENT_INTERFACE_NAME_PROPERTY, HsqlConnectionIF.class.getName()); Connection c1 = DriverManager.getConnection(url, info); CallableStatement cs = c1.prepareCall(TestConstants.HYPERSONIC_TEST_SQL); // Can we cast it? (Note: HSQLDB uses the same class for both Prepared and Callable statements) HsqlPreparedStatementIF hps = (HsqlPreparedStatementIF) cs; ! // Can we call one of vendor specific methods? ! hps.build(); // Does close() still work? hps.close(); --- 112,121 ---- info.setProperty(ProxoolConstants.USER_PROPERTY, TestConstants.HYPERSONIC_USER); info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); ! info.setProperty(ProxoolConstants.INJECTABLE_CALLABLE_STATEMENT_INTERFACE_NAME_PROPERTY, HsqlPreparedStatementIF.class.getName()); Connection c1 = DriverManager.getConnection(url, info); CallableStatement cs = c1.prepareCall(TestConstants.HYPERSONIC_TEST_SQL); // Can we cast it? (Note: HSQLDB uses the same class for both Prepared and Callable statements) HsqlPreparedStatementIF hps = (HsqlPreparedStatementIF) cs; ! // TODO - call a vendor specific method? // Does close() still work? hps.close(); *************** *** 124,127 **** --- 127,133 ---- Revision history: $Log$ + Revision 1.2 2004/06/17 21:36:39 billhorsman + Removed call to private methods. They're going to fail anyway. + Revision 1.1 2004/06/02 20:59:52 billhorsman New injectable interface tests |
From: <bil...@us...> - 2004-06-17 21:34:18
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27299/src/java-test/org/logicalcobwebs/proxool Modified Files: HsqlConnectionIF.java HsqlPreparedStatementIF.java HsqlStatementIF.java Log Message: Mistake. Can't put private classes in the interface. Doh. Index: HsqlConnectionIF.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/HsqlConnectionIF.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HsqlConnectionIF.java 2 Jun 2004 20:59:52 -0000 1.1 --- HsqlConnectionIF.java 17 Jun 2004 21:33:54 -0000 1.2 *************** *** 18,23 **** public interface HsqlConnectionIF extends Connection { - void checkClosed() throws SQLException; - } --- 18,21 ---- *************** *** 25,28 **** --- 23,29 ---- Revision history: $Log$ + Revision 1.2 2004/06/17 21:33:54 billhorsman + Mistake. Can't put private classes in the interface. Doh. + Revision 1.1 2004/06/02 20:59:52 billhorsman New injectable interface tests Index: HsqlPreparedStatementIF.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/HsqlPreparedStatementIF.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HsqlPreparedStatementIF.java 2 Jun 2004 20:59:52 -0000 1.1 --- HsqlPreparedStatementIF.java 17 Jun 2004 21:33:54 -0000 1.2 *************** *** 17,22 **** public interface HsqlPreparedStatementIF extends PreparedStatement { - String build(); - } --- 17,20 ---- *************** *** 24,27 **** --- 22,28 ---- Revision history: $Log$ + Revision 1.2 2004/06/17 21:33:54 billhorsman + Mistake. Can't put private classes in the interface. Doh. + Revision 1.1 2004/06/02 20:59:52 billhorsman New injectable interface tests Index: HsqlStatementIF.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/HsqlStatementIF.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HsqlStatementIF.java 2 Jun 2004 20:59:52 -0000 1.1 --- HsqlStatementIF.java 17 Jun 2004 21:33:54 -0000 1.2 *************** *** 18,23 **** public interface HsqlStatementIF extends Statement { - void checkClosed() throws SQLException; - } --- 18,21 ---- *************** *** 25,28 **** --- 23,29 ---- Revision history: $Log$ + Revision 1.2 2004/06/17 21:33:54 billhorsman + Mistake. Can't put private classes in the interface. Doh. + Revision 1.1 2004/06/02 20:59:52 billhorsman New injectable interface tests |
From: <bil...@us...> - 2004-06-17 21:33:21
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin/jndi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26763/src/java/org/logicalcobwebs/proxool/admin/jndi Modified Files: ProxoolJNDIHelper.java Log Message: JavaDoc fix Index: ProxoolJNDIHelper.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/admin/jndi/ProxoolJNDIHelper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ProxoolJNDIHelper.java 18 Mar 2004 17:13:48 -0000 1.2 --- ProxoolJNDIHelper.java 17 Jun 2004 21:33:12 -0000 1.3 *************** *** 27,31 **** /** ! * Create a {@link org.logicalcobwebs.proxool.ProxoolManagedDataSource} with the given alias * and bind it to JNDI using the given jndi properties. * @param jndiProperties the jndi related configuration properties. --- 27,31 ---- /** ! * Create a {@link org.logicalcobwebs.proxool.ProxoolDataSource} with the given alias * and bind it to JNDI using the given jndi properties. * @param jndiProperties the jndi related configuration properties. *************** *** 49,52 **** --- 49,55 ---- Revision history: $Log$ + Revision 1.3 2004/06/17 21:33:12 billhorsman + JavaDoc fix + Revision 1.2 2004/03/18 17:13:48 chr32 Started using ProxoolDataSource instead of ProxoolManagedDataSource. |
From: <bil...@us...> - 2004-06-17 21:31:04
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/resources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24538/src/java/org/logicalcobwebs/proxool/resources Modified Files: attributeDescriptions.properties Log Message: Checked and corrected all properties Index: attributeDescriptions.properties =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/resources/attributeDescriptions.properties,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** attributeDescriptions.properties 23 Oct 2003 23:18:17 -0000 1.5 --- attributeDescriptions.properties 17 Jun 2004 21:30:52 -0000 1.6 *************** *** 12,17 **** All SQLExceptions are caught and tested for containing this text fragment. \ If it matches than this connection is considered useless and it is discarded. \ ! Regardless of what happens the exception is always thrown again. This property behaves like a collection; \ ! you can set it more than once and each value is checked. fatal-sql-exception-wrapper-class=\ --- 12,18 ---- All SQLExceptions are caught and tested for containing this text fragment. \ If it matches than this connection is considered useless and it is discarded. \ ! Regardless of what happens the exception is always thrown again. This property \ ! behaves like a collection; separate multiple exception fragments with a comma. \ ! Default: null. fatal-sql-exception-wrapper-class=\ *************** *** 25,47 **** house-keeping-sleep-time=\ How long the house keeping thread sleeps for (milliseconds). \ ! The house keeper is responsible for checking the state of all the connections and tests whether any need to be \ ! destroyed or created. Default is 30 seconds. house-keeping-test-sql=\ ! If the house keeping thread finds and idle connections it will test them \ with this SQL statement. It should be _very_ quick to execute. Something like checking the current date or something. \ ! If not defined then this test is omitted. maximum-active-time=\ If the housekeeper comes across a thread that has been active for longer than \ this then it will kill it. So make sure you set this to a number bigger than your slowest expected response! \ ! Default is 5 minutes. maximum-connection-count=\ ! The maximum number of connections to the database. Default is 15. maximum-connection-lifetime=\ The maximum amount of time that a connection exists for before it is \ ! killed (milliseconds). Default is 4 hours. maximum-new-connections=\ --- 26,82 ---- house-keeping-sleep-time=\ How long the house keeping thread sleeps for (milliseconds). \ ! The house keeper is responsible for checking the state of all the connections and sees whether any need to be \ ! destroyed or created. It also runs any tests that have been configured. Default is 30000 (30 seconds). house-keeping-test-sql=\ ! If the house keeping thread finds any idle connections it will test them \ with this SQL statement. It should be _very_ quick to execute. Something like checking the current date or something. \ ! If not defined then this test is omitted. Default: null. ! ! injectable-connection-interface=\ ! If this is set then all connections will implement this interface. You will be able to cast a served connection \ ! into this interface and call any of its methods. Note: the vendor connection does not have to implement this method \ ! directly - in fact it shouldn't, because if it does it will be exposed automatically. If the vendor connection \ ! doesn't implement a method that matches the signature of the interface method then you will get a RuntimeException \ ! when you try and call that method. Default: null (no additional interfaces are exposed. ! ! injectable-statement-interface=\ ! If this is set then all statements will implement this interface. You will be able to cast a served statement \ ! into this interface and call any of its methods. Note: the vendor statement does not have to implement this method \ ! directly - in fact it shouldn't, because if it does it will be exposed automatically. If the vendor statement \ ! doesn't implement a method that matches the signature of the interface method then you will get a RuntimeException \ ! when you try and call that method. Default: null (no additional interfaces are exposed. ! ! injectable-prepared-statement-interface=\ ! If this is set then all prepared statements will implement this interface. You will be able to cast a served prepared statement \ ! into this interface and call any of its methods. Note: the vendor prepared statement does not have to implement this method \ ! directly - in fact it shouldn't, because if it does it will be exposed automatically. If the vendor prepared statement \ ! doesn't implement a method that matches the signature of the interface method then you will get a RuntimeException \ ! when you try and call that method. Default: null (no additional interfaces are exposed. ! ! injectable-callable-statement-interface=\ ! If this is set then all callable statements will implement this interface. You will be able to cast a served callable statement \ ! into this interface and call any of its methods. Note: the vendor callable statement does not have to implement this method \ ! directly - in fact it shouldn't, because if it does it will be exposed automatically. If the vendor callable statement \ ! doesn't implement a method that matches the signature of the interface method then you will get a RuntimeException \ ! when you try and call that method. Default: null (no additional interfaces are exposed. ! ! jmx=\ ! Indicate wether this pool should be registered with JMX or not. True or false. Default is false. ! ! jmx-agent-id=\ ! Get a comma separated list of JMX agent ids (as used by MBeanServerFactory) to register the pool to. maximum-active-time=\ If the housekeeper comes across a thread that has been active for longer than \ this then it will kill it. So make sure you set this to a number bigger than your slowest expected response! \ ! Units: milliseconds. Default: 300000 (5 minutes). maximum-connection-count=\ ! The maximum number of connections to the database. Default: 15. maximum-connection-lifetime=\ The maximum amount of time that a connection exists for before it is \ ! killed. Units: milliseconds. Default: 14400000 (4 hours). maximum-new-connections=\ *************** *** 51,83 **** takes a finite time between deciding to build the connection and it becoming available we need some way of ensuring \ that a lot of threads don't all decide to build a connection at once. (We could solve this in a smarter way - and \ ! indeed we will one day) Default is 10. ! ! simultaneous-build-throttle=\ ! This is the maximum number of connections we can be building at any \ ! one time. That is, the number of new connections that have been requested but aren't yet available for use. \ ! Because connections can be built using more than one thread (for instance, when they are built on demand) and it \ ! takes a finite time between deciding to build the connection and it becoming available we need some way of ensuring \ ! that a lot of threads don't all decide to build a connection at once. (We could solve this in a smarter way - and \ ! indeed we will one day) Default is 10. minimum-connection-count=\ The minimum number of connections we will keep open, regardless of \ ! whether anyone needs them or not. Default is 5. overload-without-refusal-lifetime=\ This helps us determine the pool status. If we have refused a \ ! connection within this threshold (milliseconds) then we are overloaded. Default is 60 seconds. ! ! recently-started-threshold=\ ! This helps us determine whether the pool status is up, down or \ ! overloaded. As long as at least one connection was started within this threshold (milliseconds) or there are some \ ! spare connections available then we assume the pool is up. Default is 60 seconds. ! ! trace=\ ! If true then each SQL call gets logged (DEBUG level) along with the execution time. \ ! You can also get this information by registering a ConnectionListener (see ProxoolFacade). Default is false. ! ! verbose=\ ! Either false (quiet) or true (loud). Default is false. prototype-count=\ --- 86,98 ---- takes a finite time between deciding to build the connection and it becoming available we need some way of ensuring \ that a lot of threads don't all decide to build a connection at once. (We could solve this in a smarter way - and \ ! indeed we will one day) Default: 10. minimum-connection-count=\ The minimum number of connections we will keep open, regardless of \ ! whether anyone needs them or not. Default: 5. overload-without-refusal-lifetime=\ This helps us determine the pool status. If we have refused a \ ! connection within this threshold (milliseconds) then we are overloaded. Units: milliseconds. Default: 60000 (1 minute). prototype-count=\ *************** *** 87,108 **** This differs from minimum-connection-count because it takes into account the number of active connections. \ minimum-connection-count is absolute and doesn't care how many are in use. prototype-count is the number of \ ! spare connections it strives to keep over and above the ones that are currently active. Default is 0. statistics=\ The sample length when taking statistical information, comma-delimited. \ For example: '10s,15m' would mean take samples every 10 seconds and every 15 minutes. Valid units are \ ! s(econds), m(inutes), h(ours) and d(ays). Default is null (no statistics). statistics-log-level=\ Whether statistics are logged as they are produced. \ ! Range: DEBUG, INFO, WARN, ERROR, FATAL. Default is null (no logging). test-after-use=\ If you set this to true then each connection is tested (with whatever is defined in \ house-keeping-test-sql) after it is closed (that is, returned to the connection pool). \ ! If a connection fails then it is discarded. test-before-use=\ If you set this to true then each connection is tested (with whatever is defined in house-keeping-test-sql) \ before being served. If a connection fails then it is discarded and another one is picked. If all \ ! connections fail a new one is built. If that one fails then you get an SQLException saying so. \ No newline at end of file --- 102,146 ---- This differs from minimum-connection-count because it takes into account the number of active connections. \ minimum-connection-count is absolute and doesn't care how many are in use. prototype-count is the number of \ ! spare connections it strives to keep over and above the ones that are currently active. Default: 0. ! ! recently-started-threshold=\ ! This helps us determine whether the pool status is up, down or \ ! overloaded. As long as at least one connection was started within this threshold (milliseconds) or there are some \ ! spare connections available then we assume the pool is up. Units: milliseconds. Default: 60000 (1 minute). ! ! simultaneous-build-throttle=\ ! This is the maximum number of connections we can be building at any \ ! one time. That is, the number of new connections that have been requested but aren't yet available for use. \ ! Because connections can be built using more than one thread (for instance, when they are built on demand) and it \ ! takes a finite time between deciding to build the connection and it becoming available we need some way of ensuring \ ! that a lot of threads don't all decide to build a connection at once. (We could solve this in a smarter way - and \ ! indeed we will one day) Default: 10. statistics=\ The sample length when taking statistical information, comma-delimited. \ For example: '10s,15m' would mean take samples every 10 seconds and every 15 minutes. Valid units are \ ! s(econds), m(inutes), h(ours) and d(ays). Default: null (no statistics). statistics-log-level=\ Whether statistics are logged as they are produced. \ ! Range: DEBUG, INFO, WARN, ERROR, FATAL. Default: null (no logging). test-after-use=\ If you set this to true then each connection is tested (with whatever is defined in \ house-keeping-test-sql) after it is closed (that is, returned to the connection pool). \ ! If a connection fails then it is discarded. True or false. Default: false. test-before-use=\ If you set this to true then each connection is tested (with whatever is defined in house-keeping-test-sql) \ before being served. If a connection fails then it is discarded and another one is picked. If all \ ! connections fail a new one is built. If that one fails then you get an SQLException saying so. \ ! True or false. Default: false. ! ! trace=\ ! If true then each SQL call gets logged (DEBUG level) along with the execution time. \ ! You can also get this information by registering a ConnectionListener (see ProxoolFacade). \ ! True or false. Default: false. ! ! verbose=\ ! Either false (quiet) or true (loud). True or false. Default: false. ! |
From: <bil...@us...> - 2004-06-17 21:28:10
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/MethodMapper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22172/src/java/org/logicalcobwebs/proxool/MethodMapper Log Message: Directory /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/MethodMapper added to the repository |
From: <bil...@us...> - 2004-06-02 21:13:50
|
Update of /cvsroot/proxool/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25797 Modified Files: CHANGES.txt Log Message: change log Index: CHANGES.txt =================================================================== RCS file: /cvsroot/proxool/proxool/CHANGES.txt,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** CHANGES.txt 22 Apr 2004 07:11:06 -0000 1.35 --- CHANGES.txt 2 Jun 2004 21:13:40 -0000 1.36 *************** *** 10,19 **** - New DataSource implementation. TODO more ! - All connections are now wrapped in disposable wrappers. TODO more - Connections, Statements, PreparedStatements, and CallableStatements now implement all the public intefaces that the delegate connection does. This means that you can, for instance, cast a Connection directly to the driver specific one. Or more precisely, ! any of the interfaces that the driver object implements. - ProxoolFacade now has killConnection that accepts the Connection object --- 10,22 ---- - 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 all the public intefaces that the delegate connection does. This means that you can, for instance, cast a Connection directly to the driver specific one. Or more precisely, ! any of the interfaces that the driver object implements. You can only cast your exception ! into an interface - concrete classes aren't supported at this time. - ProxoolFacade now has killConnection that accepts the Connection object *************** *** 24,27 **** --- 27,37 ---- - ProxoolFacade now has getAlias() which will give you the pool alias for any connection. + - ProxoolFacade now has a no-parameter overloaded version of shutdown() for ease of integration with + the Spring Framework. + + - ProxoolDriver no longer logs all SQLExceptions. It's up to the client to log exceptions as it + sees fit. (With some changes to the tests, this means that we no longer get any stack traces + output during testing when we encounter *expected* errors). + 0.8.3 - 14 December 2003 |
From: <bil...@us...> - 2004-06-02 21:12:42
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25589/src/java-test/org/logicalcobwebs/proxool Modified Files: log4j-test.xml Log Message: Add file and line number to format Index: log4j-test.xml =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/log4j-test.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** log4j-test.xml 28 Feb 2003 15:22:09 -0000 1.2 --- log4j-test.xml 2 Jun 2004 21:12:34 -0000 1.3 *************** *** 6,10 **** <appender name="console" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> ! <param name="ConversionPattern" value="%d{DATE} [%-5p] %c{4} - %m%n"/> </layout> </appender> --- 6,10 ---- <appender name="console" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> ! <param name="ConversionPattern" value="%d{DATE} [%-5p] {%F:%L} %c{4} - %m%n"/> </layout> </appender> |
From: <bil...@us...> - 2004-06-02 21:11:34
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25257/src/java-test/org/logicalcobwebs/proxool Modified Files: WrapperTest.java Log Message: Fix equality test. Index: WrapperTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/WrapperTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WrapperTest.java 23 Mar 2004 21:25:54 -0000 1.2 --- WrapperTest.java 2 Jun 2004 21:11:24 -0000 1.3 *************** *** 227,233 **** Connection c2 = DriverManager.getConnection(url, info); ! assertTrue("c1 != c2", !c1.equals(c2)); c2.close(); ! assertTrue("c1 != c2", !c1.equals(c2)); } --- 227,233 ---- Connection c2 = DriverManager.getConnection(url, info); ! assertTrue("c1 == c2", c1.equals(c2)); c2.close(); ! assertTrue("c1 == c2", c1.equals(c2)); } |
From: <bil...@us...> - 2004-06-02 21:05:28
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23863/src/java-test/org/logicalcobwebs/proxool Modified Files: ConnectionPoolTest.java HouseKeeperTest.java StateListenerTest.java Log Message: Don't log worrying stack traces for expected exceptions. Index: ConnectionPoolTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/ConnectionPoolTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ConnectionPoolTest.java 26 Oct 2003 16:10:46 -0000 1.1 --- ConnectionPoolTest.java 2 Jun 2004 21:05:19 -0000 1.2 *************** *** 56,60 **** fail("Didn't expect to get third connection"); } catch (SQLException e) { ! LOG.debug("Ignoring expected exception", e); } --- 56,61 ---- fail("Didn't expect to get third connection"); } catch (SQLException e) { ! // Log message only so we don't get a worrying stack trace ! LOG.debug("Ignoring expected exception: " + e.getMessage()); } *************** *** 94,98 **** fail("Didn't expect to get third connection"); } catch (SQLException e) { ! LOG.debug("Ignoring expected exception", e); } --- 95,100 ---- fail("Didn't expect to get third connection"); } catch (SQLException e) { ! // Log message only so we don't get a worrying stack trace ! LOG.debug("Ignoring expected exception: " + e.getMessage()); } *************** *** 195,198 **** --- 197,203 ---- Revision history: $Log$ + Revision 1.2 2004/06/02 21:05:19 billhorsman + Don't log worrying stack traces for expected exceptions. + Revision 1.1 2003/10/26 16:10:46 billhorsman renamed to be more consistent Index: HouseKeeperTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/HouseKeeperTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** HouseKeeperTest.java 30 Sep 2003 18:40:16 -0000 1.8 --- HouseKeeperTest.java 2 Jun 2004 21:05:19 -0000 1.9 *************** *** 138,142 **** fail("Expected to get an exception because the test failed"); } catch (SQLException e) { ! LOG.debug("Expected exception.", e); } --- 138,143 ---- fail("Expected to get an exception because the test failed"); } catch (SQLException e) { ! // Log message only so we don't get a worrying stack trace ! LOG.debug("Expected exception: " + e.getMessage()); } *************** *** 225,228 **** --- 226,232 ---- Revision history: $Log$ + 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 Index: StateListenerTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/StateListenerTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** StateListenerTest.java 4 Mar 2003 10:58:44 -0000 1.11 --- StateListenerTest.java 2 Jun 2004 21:05:19 -0000 1.12 *************** *** 75,79 **** } catch (SQLException e) { // We expect a refusal here ! LOG.debug("Expected refusal", e); } --- 75,80 ---- } catch (SQLException e) { // We expect a refusal here ! // Log message only so we don't get a worrying stack trace ! LOG.debug("Ignoring expected refusal: " + e.getMessage()); } *************** *** 156,159 **** --- 157,163 ---- Revision history: $Log$ + Revision 1.12 2004/06/02 21:05:19 billhorsman + Don't log worrying stack traces for expected exceptions. + Revision 1.11 2003/03/04 10:58:44 billhorsman checkstyle |
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22282/src/java-test/org/logicalcobwebs/proxool Added Files: HsqlConnectionIF.java HsqlPreparedStatementIF.java HsqlStatementIF.java InjectableInterfaceTest.java Log Message: New injectable interface tests --- NEW FILE: HsqlConnectionIF.java --- /* * This software is released under a licence similar to the Apache Software Licence. * See org.logicalcobwebs.proxool.package.html for details. * The latest version is available at http://proxool.sourceforge.net */ package org.logicalcobwebs.proxool; import java.sql.SQLException; import java.sql.Connection; /** * Supports {@link InjectableInterfaceTest} * @author <a href="mailto:bi...@lo...">Bill Horsman</a> * @author $Author: billhorsman $ (current maintainer) * @version $Revision: 1.1 $, $Date: 2004/06/02 20:59:52 $ * @since 0.9.0 */ public interface HsqlConnectionIF extends Connection { void checkClosed() throws SQLException; } /* Revision history: $Log: HsqlConnectionIF.java,v $ Revision 1.1 2004/06/02 20:59:52 billhorsman New injectable interface tests */ --- NEW FILE: HsqlPreparedStatementIF.java --- /* * This software is released under a licence similar to the Apache Software Licence. * See org.logicalcobwebs.proxool.package.html for details. * The latest version is available at http://proxool.sourceforge.net */ package org.logicalcobwebs.proxool; import java.sql.PreparedStatement; /** * Supports {@link InjectableInterfaceTest} * @author <a href="mailto:bi...@lo...">Bill Horsman</a> * @author $Author: billhorsman $ (current maintainer) * @version $Revision: 1.1 $, $Date: 2004/06/02 20:59:52 $ * @since 0.9.0 */ public interface HsqlPreparedStatementIF extends PreparedStatement { String build(); } /* Revision history: $Log: HsqlPreparedStatementIF.java,v $ Revision 1.1 2004/06/02 20:59:52 billhorsman New injectable interface tests */ --- NEW FILE: HsqlStatementIF.java --- /* * This software is released under a licence similar to the Apache Software Licence. * See org.logicalcobwebs.proxool.package.html for details. * The latest version is available at http://proxool.sourceforge.net */ package org.logicalcobwebs.proxool; import java.sql.SQLException; import java.sql.Statement; /** * Supports {@link InjectableInterfaceTest} * @author <a href="mailto:bi...@lo...">Bill Horsman</a> * @author $Author: billhorsman $ (current maintainer) * @version $Revision: 1.1 $, $Date: 2004/06/02 20:59:52 $ * @since 0.9.0 */ public interface HsqlStatementIF extends Statement { void checkClosed() throws SQLException; } /* Revision history: $Log: HsqlStatementIF.java,v $ Revision 1.1 2004/06/02 20:59:52 billhorsman New injectable interface tests */ --- NEW FILE: InjectableInterfaceTest.java --- /* * This software is released under a licence similar to the Apache Software Licence. * See org.logicalcobwebs.proxool.package.html for details. * The latest version is available at http://proxool.sourceforge.net */ package org.logicalcobwebs.proxool; import java.util.Properties; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.PreparedStatement; import java.sql.CallableStatement; /** * Tests whether we can inject a new interface into one of the proxy objects * @version $Revision: 1.1 $, $Date: 2004/06/02 20:59:52 $ * @author <a href="mailto:bi...@lo...">Bill Horsman</a> * @author $Author: billhorsman $ (current maintainer) * @since Proxool 0.9 */ public class InjectableInterfaceTest extends AbstractProxoolTest { /** * @see AbstractProxoolTest */ public InjectableInterfaceTest(String alias) { super(alias); } /** * Get a connection and cast it into the appropriate interface */ public void testInjectableConnectionInterface() throws Exception { String alias = "injectableConnectionInterface"; 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.INJECTABLE_CONNECTION_INTERFACE_NAME_PROPERTY, HsqlConnectionIF.class.getName()); Connection c1 = DriverManager.getConnection(url, info); // Can we cast it? HsqlConnectionIF hc = (HsqlConnectionIF) c1; // Can we call one of vendor specific methods? hc.checkClosed(); // Does close() still work? hc.close(); assertTrue("c1.isClosed()", c1.isClosed()); } /** * Get a statement and cast it into the appropriate interface */ public void testInjectableStatementInterface() throws Exception { String alias = "injectableStatementInterface"; 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.INJECTABLE_STATEMENT_INTERFACE_NAME_PROPERTY, HsqlConnectionIF.class.getName()); Connection c1 = DriverManager.getConnection(url, info); Statement s = c1.createStatement(); // Can we cast it? HsqlStatementIF hs = (HsqlStatementIF) s; // Can we call one of vendor specific methods? hs.checkClosed(); // Does close() still work? hs.close(); c1.close(); } /** * Get a statement and cast it into the appropriate interface */ public void testInjectablePreparedStatementInterface() throws Exception { String alias = "injectablePreparedStatementInterface"; 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.INJECTABLE_STATEMENT_INTERFACE_NAME_PROPERTY, HsqlConnectionIF.class.getName()); Connection c1 = DriverManager.getConnection(url, info); PreparedStatement ps = c1.prepareStatement(TestConstants.HYPERSONIC_TEST_SQL); // Can we cast it? HsqlPreparedStatementIF hps = (HsqlPreparedStatementIF) ps; // Can we call one of vendor specific methods? hps.build(); // Does close() still work? hps.close(); c1.close(); } /** * Get a statement and cast it into the appropriate interface */ public void testInjectableCallableStatementInterface() throws Exception { String alias = "injectableCallableStatementInterface"; 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.INJECTABLE_STATEMENT_INTERFACE_NAME_PROPERTY, HsqlConnectionIF.class.getName()); Connection c1 = DriverManager.getConnection(url, info); CallableStatement cs = c1.prepareCall(TestConstants.HYPERSONIC_TEST_SQL); // Can we cast it? (Note: HSQLDB uses the same class for both Prepared and Callable statements) HsqlPreparedStatementIF hps = (HsqlPreparedStatementIF) cs; // Can we call one of vendor specific methods? hps.build(); // Does close() still work? hps.close(); c1.close(); } } /* Revision history: $Log: InjectableInterfaceTest.java,v $ Revision 1.1 2004/06/02 20:59:52 billhorsman New injectable interface tests */ |
From: <bil...@us...> - 2004-06-02 20:56:03
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/cglib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21358/src/java-test/org/logicalcobwebs/cglib Modified Files: EnhancerTest.java Log Message: Make sure test doesn't throw a ClassCastException Index: EnhancerTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/cglib/EnhancerTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EnhancerTest.java 2 Jun 2004 20:54:57 -0000 1.1 --- EnhancerTest.java 2 Jun 2004 20:55:54 -0000 1.2 *************** *** 30,34 **** mi.bar(); ! MyConcreteClass mcc = (MyConcreteClass) mi; // This fails // assertEquals("foo()", "proxiedFoo", mcc.foo()); --- 30,38 ---- mi.bar(); ! try { ! MyConcreteClass mcc = (MyConcreteClass) mi; ! } catch (ClassCastException e) { ! // Expected this :( ! } // This fails // assertEquals("foo()", "proxiedFoo", mcc.foo()); *************** *** 40,43 **** --- 44,50 ---- Revision history: $Log$ + Revision 1.2 2004/06/02 20:55:54 billhorsman + Make sure test doesn't throw a ClassCastException + Revision 1.1 2004/06/02 20:54:57 billhorsman Learning test class for Enhancer. It fails (or would if the assert was uncommented). Left in for knowledge. |
From: <bil...@us...> - 2004-06-02 20:55:06
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/cglib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21087/src/java-test/org/logicalcobwebs/cglib Added Files: EnhancerTest.java MyConcreteClass.java MyInterfaceIF.java MyProxy.java Log Message: Learning test class for Enhancer. It fails (or would if the assert was uncommented). Left in for knowledge. --- NEW FILE: EnhancerTest.java --- /* * This software is released under a licence similar to the Apache Software Licence. * See org.logicalcobwebs.proxool.package.html for details. * The latest version is available at http://proxool.sourceforge.net */ package org.logicalcobwebs.cglib; import org.logicalcobwebs.proxool.AbstractProxoolTest; import org.logicalcobwebs.cglib.proxy.Enhancer; /** * A test test class (!) to help me understand the Enhancer. It fails. Or at least, * it would do if I uncommented the assert. But that fines. It's a learning process. * @version $Revision: 1.1 $, $Date: 2004/06/02 20:54:57 $ * @author billhorsman * @author $Author: billhorsman $ (current maintainer) */ public class EnhancerTest extends AbstractProxoolTest { public EnhancerTest(String alias) { super(alias); } public void testConcreteClassEnhancer() { MyInterfaceIF mi = (MyInterfaceIF) Enhancer.create( null, new Class[] {MyInterfaceIF.class}, new MyProxy(new MyConcreteClass())); mi.bar(); MyConcreteClass mcc = (MyConcreteClass) mi; // This fails // assertEquals("foo()", "proxiedFoo", mcc.foo()); } } /* Revision history: $Log: EnhancerTest.java,v $ Revision 1.1 2004/06/02 20:54:57 billhorsman Learning test class for Enhancer. It fails (or would if the assert was uncommented). Left in for knowledge. */ --- NEW FILE: MyConcreteClass.java --- /* * This software is released under a licence similar to the Apache Software Licence. * See org.logicalcobwebs.proxool.package.html for details. * The latest version is available at http://proxool.sourceforge.net */ package org.logicalcobwebs.cglib; import org.logicalcobwebs.logging.Log; import org.logicalcobwebs.logging.LogFactory; import org.logicalcobwebs.proxool.WrappedConnection; /** * See {@link EnhancerTest} * @version $Revision: 1.1 $, $Date: 2004/06/02 20:54:57 $ * @author billhorsman * @author $Author: billhorsman $ (current maintainer) */ public class MyConcreteClass implements MyInterfaceIF { private static final Log LOG = LogFactory.getLog(MyConcreteClass.class); MyConcreteClass() { LOG.error("MyConcreteClass.init"); } public String foo() { return "foo"; } public void bar() {} } /* Revision history: $Log: MyConcreteClass.java,v $ Revision 1.1 2004/06/02 20:54:57 billhorsman Learning test class for Enhancer. It fails (or would if the assert was uncommented). Left in for knowledge. */ --- NEW FILE: MyInterfaceIF.java --- /* * This software is released under a licence similar to the Apache Software Licence. * See org.logicalcobwebs.proxool.package.html for details. * The latest version is available at http://proxool.sourceforge.net */ package org.logicalcobwebs.cglib; /** * See {@link EnhancerTest} * @version $Revision: 1.1 $, $Date: 2004/06/02 20:54:57 $ * @author billhorsman * @author $Author: billhorsman $ (current maintainer) */ public interface MyInterfaceIF { public void bar(); } /* Revision history: $Log: MyInterfaceIF.java,v $ Revision 1.1 2004/06/02 20:54:57 billhorsman Learning test class for Enhancer. It fails (or would if the assert was uncommented). Left in for knowledge. */ --- NEW FILE: MyProxy.java --- /* * This software is released under a licence similar to the Apache Software Licence. * See org.logicalcobwebs.proxool.package.html for details. * The latest version is available at http://proxool.sourceforge.net */ package org.logicalcobwebs.cglib; import org.logicalcobwebs.cglib.proxy.MethodInterceptor; import org.logicalcobwebs.cglib.proxy.MethodProxy; import java.lang.reflect.Method; /** * See {@link EnhancerTest} * @version $Revision: 1.1 $, $Date: 2004/06/02 20:54:57 $ * @author billhorsman * @author $Author: billhorsman $ (current maintainer) */ public class MyProxy implements MethodInterceptor { private MyConcreteClass myConcreteClass; public MyProxy(MyConcreteClass myConcreteClass) { this.myConcreteClass = myConcreteClass; } public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { if (method.getName().equals("foo")) { return "proxiedFoo"; } else { return method.invoke(myConcreteClass, args); } } } /* Revision history: $Log: MyProxy.java,v $ Revision 1.1 2004/06/02 20:54:57 billhorsman Learning test class for Enhancer. It fails (or would if the assert was uncommented). Left in for knowledge. */ |
From: <bil...@us...> - 2004-06-02 20:51:52
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/cglib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20292/src/java-test/org/logicalcobwebs/cglib Log Message: Directory /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/cglib added to the repository |
From: <bil...@us...> - 2004-06-02 20:50:57
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20116/src/java/org/logicalcobwebs/proxool Modified Files: ProxyDatabaseMetaData.java ProxyFactory.java WrappedConnection.java Log Message: Dropped obsolete InvocationHandler reference and injectable interface stuff. Index: ProxyDatabaseMetaData.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxyDatabaseMetaData.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ProxyDatabaseMetaData.java 23 Mar 2004 21:19:45 -0000 1.7 --- ProxyDatabaseMetaData.java 2 Jun 2004 20:50:47 -0000 1.8 *************** *** 11,20 **** import org.logicalcobwebs.cglib.proxy.MethodInterceptor; import org.logicalcobwebs.cglib.proxy.MethodProxy; - import org.logicalcobwebs.cglib.proxy.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.sql.Connection; - import java.sql.SQLException; import java.sql.DatabaseMetaData; --- 11,18 ---- *************** *** 26,30 **** * @author $Author$ (current maintainer) */ ! class ProxyDatabaseMetaData implements MethodInterceptor, InvocationHandler { private static final Log LOG = LogFactory.getLog(ProxyDatabaseMetaData.class); --- 24,28 ---- * @author $Author$ (current maintainer) */ ! class ProxyDatabaseMetaData implements MethodInterceptor { private static final Log LOG = LogFactory.getLog(ProxyDatabaseMetaData.class); *************** *** 40,53 **** private Connection wrappedConnection; ! public ProxyDatabaseMetaData(Connection connection, Connection wrappedConnection) throws SQLException { ! databaseMetaData = connection.getMetaData(); this.wrappedConnection = wrappedConnection; } ! public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { ! return invoke(proxy, method, args); ! } ! ! public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result = null; int argCount = args != null ? args.length : 0; --- 38,51 ---- private Connection wrappedConnection; ! /** ! * @param databaseMetaData the meta data we use to delegate all calls to (except getConnection()) ! * @param wrappedConnection the connection we return if asked for the connection ! */ ! public ProxyDatabaseMetaData(DatabaseMetaData databaseMetaData, Connection wrappedConnection) { ! this.databaseMetaData = databaseMetaData; this.wrappedConnection = wrappedConnection; } ! public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object result = null; int argCount = args != null ? args.length : 0; *************** *** 113,116 **** --- 111,117 ---- Revision history: $Log$ + Revision 1.8 2004/06/02 20:50:47 billhorsman + Dropped obsolete InvocationHandler reference and injectable interface stuff. + Revision 1.7 2004/03/23 21:19:45 billhorsman Added disposable wrapper to proxied connection. And made proxied objects implement delegate interfaces too. Index: ProxyFactory.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxyFactory.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ProxyFactory.java 23 Mar 2004 21:19:45 -0000 1.26 --- ProxyFactory.java 2 Jun 2004 20:50:47 -0000 1.27 *************** *** 6,10 **** package org.logicalcobwebs.proxool; ! import org.logicalcobwebs.cglib.proxy.Proxy; import org.logicalcobwebs.logging.Log; import org.logicalcobwebs.logging.LogFactory; --- 6,11 ---- package org.logicalcobwebs.proxool; ! import org.logicalcobwebs.cglib.proxy.Enhancer; ! import org.logicalcobwebs.cglib.proxy.Factory; import org.logicalcobwebs.logging.Log; import org.logicalcobwebs.logging.LogFactory; *************** *** 12,17 **** import java.sql.Connection; import java.sql.DatabaseMetaData; - import java.sql.SQLException; import java.sql.Statement; import java.util.HashSet; import java.util.Set; --- 13,19 ---- import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.Statement; + import java.sql.CallableStatement; + import java.sql.PreparedStatement; import java.util.HashSet; import java.util.Set; *************** *** 44,50 **** protected static Connection getWrappedConnection(ProxyConnection proxyConnection) { final WrappedConnection wrappedConnection = new WrappedConnection(proxyConnection); Object delegate = Proxy.newProxyInstance( proxyConnection.getConnection().getClass().getClassLoader(), ! getInterfaces(proxyConnection.getConnection().getClass()), wrappedConnection); return (Connection) delegate; --- 46,64 ---- protected static Connection getWrappedConnection(ProxyConnection proxyConnection) { final WrappedConnection wrappedConnection = new WrappedConnection(proxyConnection); + /* Object delegate = Proxy.newProxyInstance( proxyConnection.getConnection().getClass().getClassLoader(), ! getInterfaces(proxyConnection.getConnection().getClass(), proxyConnection.getConnectionPool()), ! wrappedConnection); ! */ ! /* ! Object delegate = Enhancer.create( ! proxyConnection.getConnection().getClass(), ! getInterfaces(proxyConnection.getConnection().getClass(), proxyConnection.getConnectionPool()), ! wrappedConnection); ! */ ! Object delegate = Enhancer.create( ! null, ! getInterfaces(proxyConnection.getConnection().getClass(), proxyConnection.getConnectionPool()), wrappedConnection); return (Connection) delegate; *************** *** 60,64 **** --- 74,81 ---- protected static Statement getDelegateStatement(Statement statement) { Statement ds = statement; + /* ProxyStatement ps = (ProxyStatement) Proxy.getInvocationHandler(statement); + */ + ProxyStatement ps = (ProxyStatement) ((Factory)statement).getCallback(0); ds = ps.getDelegateStatement(); return ds; *************** *** 73,85 **** */ protected static Connection getDelegateConnection(Connection connection) { WrappedConnection wc = (WrappedConnection) Proxy.getInvocationHandler(connection); return wc.getProxyConnection().getConnection(); } protected static Statement getStatement(Statement delegate, ConnectionPool connectionPool, ProxyConnectionIF proxyConnection, String sqlStatement) { return (Statement) Proxy.newProxyInstance( delegate.getClass().getClassLoader(), ! getInterfaces(delegate.getClass()), new ProxyStatement(delegate, connectionPool, proxyConnection, sqlStatement)); } --- 90,118 ---- */ protected static Connection getDelegateConnection(Connection connection) { + /* WrappedConnection wc = (WrappedConnection) Proxy.getInvocationHandler(connection); + */ + WrappedConnection wc = (WrappedConnection) ((Factory)connection).getCallback(0); return wc.getProxyConnection().getConnection(); } protected static Statement getStatement(Statement delegate, ConnectionPool connectionPool, ProxyConnectionIF proxyConnection, String sqlStatement) { + Object o = Enhancer.create( + null, + getInterfaces(delegate.getClass(), connectionPool), + new ProxyStatement(delegate, connectionPool, proxyConnection, sqlStatement)); + /* + Object o = Enhancer.create( + delegate.getClass(), + getInterfaces(delegate.getClass(), connectionPool), + new ProxyStatement(delegate, connectionPool, proxyConnection, sqlStatement)); + */ + return (Statement) o; + /* return (Statement) Proxy.newProxyInstance( delegate.getClass().getClassLoader(), ! getInterfaces(delegate.getClass(), connectionPool), new ProxyStatement(delegate, connectionPool, proxyConnection, sqlStatement)); + */ } *************** *** 91,99 **** * @return an array of classes (all interfaces) that this class implements. */ ! private static Class[] getInterfaces(Class clazz) { Class[] interfaceArray = (Class[]) interfaceMap.get(clazz); if (interfaceArray == null) { Set interfaces = new HashSet(); traverseInterfacesRecursively(interfaces, clazz); interfaceArray = (Class[]) interfaces.toArray(new Class[interfaces.size()]); /* --- 124,151 ---- * @return an array of classes (all interfaces) that this class implements. */ ! private static Class[] getInterfaces(Class clazz, ConnectionPool connectionPool) { Class[] interfaceArray = (Class[]) interfaceMap.get(clazz); if (interfaceArray == null) { Set interfaces = new HashSet(); traverseInterfacesRecursively(interfaces, clazz); + if (connectionPool != null) { + // Work out which interface we should be injecting (if it has been configured). Make sure + // we check CallableStatement then PreparedStatement then Statement or all three will get + // caught by Statement + Class injectableClass = null; + if (Connection.class.isAssignableFrom(clazz)) { + injectableClass = connectionPool.getDefinition().getInjectableConnectionInterface(); + } else if (CallableStatement.class.isAssignableFrom(clazz)) { + injectableClass = connectionPool.getDefinition().getInjectableCallableStatementInterface(); + } else if (PreparedStatement.class.isAssignableFrom(clazz)) { + injectableClass = connectionPool.getDefinition().getInjectablePreparedStatementInterface(); + } else if (Statement.class.isAssignableFrom(clazz)) { + injectableClass = connectionPool.getDefinition().getInjectableStatementInterface(); + } + // Inject it if it was configured. + if (injectableClass != null) { + interfaces.add(injectableClass); + } + } interfaceArray = (Class[]) interfaces.toArray(new Class[interfaces.size()]); /* *************** *** 166,174 **** /** * Create a new DatabaseMetaData from a connection ! * @param connection the proxy connection we are using * @return databaseMetaData - * @throws SQLException if the delegfate connection couldn't get the metaData */ ! protected static DatabaseMetaData getDatabaseMetaData(Connection connection, Connection wrappedConnection) throws SQLException { return (DatabaseMetaData) Proxy.newProxyInstance( DatabaseMetaData.class.getClassLoader(), --- 218,227 ---- /** * Create a new DatabaseMetaData from a connection ! * @param databaseMetaData the meta data we use to delegate all calls to (except getConnection()) ! * @param wrappedConnection the connection we return if asked for the connection * @return databaseMetaData */ ! protected static DatabaseMetaData getDatabaseMetaData(DatabaseMetaData databaseMetaData, Connection wrappedConnection) { ! /* return (DatabaseMetaData) Proxy.newProxyInstance( DatabaseMetaData.class.getClassLoader(), *************** *** 176,179 **** --- 229,244 ---- new ProxyDatabaseMetaData(connection, wrappedConnection) ); + */ + ProxyDatabaseMetaData proxyDatabaseMetaData = new ProxyDatabaseMetaData(databaseMetaData, wrappedConnection); + Object delegate = Enhancer.create( + null, + getInterfaces(databaseMetaData.getClass(), null), + proxyDatabaseMetaData); + /* + Object delegate = Enhancer.create( + databaseMetaData.getClass(), + proxyDatabaseMetaData); + */ + return (DatabaseMetaData) delegate; } *************** *** 184,188 **** --- 249,256 ---- */ public static WrappedConnection getWrappedConnection(Connection connection) { + /* return (WrappedConnection) Proxy.getInvocationHandler(connection); + */ + return (WrappedConnection) ((Factory)connection).getCallback(0); } *************** *** 192,195 **** --- 260,266 ---- Revision history: $Log$ + Revision 1.27 2004/06/02 20:50:47 billhorsman + Dropped obsolete InvocationHandler reference and injectable interface stuff. + Revision 1.26 2004/03/23 21:19:45 billhorsman Added disposable wrapper to proxied connection. And made proxied objects implement delegate interfaces too. Index: WrappedConnection.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/WrappedConnection.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WrappedConnection.java 23 Mar 2004 21:19:45 -0000 1.1 --- WrappedConnection.java 2 Jun 2004 20:50:47 -0000 1.2 *************** *** 11,14 **** --- 11,15 ---- import org.logicalcobwebs.logging.Log; import org.logicalcobwebs.logging.LogFactory; + import org.logicalcobwebs.proxool.proxy.InvokerFacade; import java.lang.reflect.Method; *************** *** 25,29 **** * @since Proxool 0.9 */ ! public class WrappedConnection implements InvocationHandler, MethodInterceptor { private static final Log LOG = LogFactory.getLog(WrappedConnection.class); --- 26,30 ---- * @since Proxool 0.9 */ ! public class WrappedConnection implements MethodInterceptor { private static final Log LOG = LogFactory.getLog(WrappedConnection.class); *************** *** 98,103 **** Object result = null; int argCount = args != null ? args.length : 0; try { ! if (method.getName().equals(CLOSE_METHOD)) { // It's okay to close a connection twice. Only we ignore the // second time. --- 99,108 ---- Object result = null; int argCount = args != null ? args.length : 0; + Method concreteMethod = method; + if (proxyConnection != null && proxyConnection.getConnection() != null) { + concreteMethod = InvokerFacade.getConcreteMethod(proxyConnection.getConnection().getClass(), method); + } try { ! if (concreteMethod.getName().equals(CLOSE_METHOD)) { // It's okay to close a connection twice. Only we ignore the // second time. *************** *** 107,134 **** proxyConnection = null; } ! } else if (method.getName().equals(EQUALS_METHOD) && argCount == 1) { result = equals(args[0]) ? Boolean.TRUE : Boolean.FALSE; ! } else if (method.getName().equals(HASH_CODE_METHOD) && argCount == 0) { result = new Integer(hashCode()); ! } else if (method.getName().equals(IS_CLOSED_METHOD) && argCount == 0) { result = (proxyConnection == null || proxyConnection.isClosed()) ? Boolean.TRUE : Boolean.FALSE; ! } else if (method.getName().equals(GET_META_DATA_METHOD) && argCount == 0) { if (proxyConnection != null) { ! result = ProxyFactory.getDatabaseMetaData(proxyConnection.getConnection(),(Connection) proxy); } else { ! throw new SQLException("You can't perform a " + method.getName() + " operation after the connection has been closed"); } ! } else if (method.getName().equals(FINALIZE_METHOD)) { super.finalize(); ! } else if (method.getName().equals(TO_STRING_METHOD)) { result = toString(); } else { if (proxyConnection != null) { ! if (method.getName().startsWith(ConnectionResetter.MUTATOR_PREFIX)) { proxyConnection.setNeedToReset(true); } ! result = method.invoke(proxyConnection.getConnection(), args); } else { ! throw new SQLException("You can't perform a " + method.getName() + " operation after the connection has been closed"); } } --- 112,140 ---- proxyConnection = null; } ! } else if (concreteMethod.getName().equals(EQUALS_METHOD) && argCount == 1) { result = equals(args[0]) ? Boolean.TRUE : Boolean.FALSE; ! } else if (concreteMethod.getName().equals(HASH_CODE_METHOD) && argCount == 0) { result = new Integer(hashCode()); ! } else if (concreteMethod.getName().equals(IS_CLOSED_METHOD) && argCount == 0) { result = (proxyConnection == null || proxyConnection.isClosed()) ? Boolean.TRUE : Boolean.FALSE; ! } else if (concreteMethod.getName().equals(GET_META_DATA_METHOD) && argCount == 0) { if (proxyConnection != null) { ! Connection connection = ProxyFactory.getWrappedConnection(proxyConnection); ! result = ProxyFactory.getDatabaseMetaData(proxyConnection.getConnection().getMetaData(), connection); } else { ! throw new SQLException("You can't perform a " + concreteMethod.getName() + " operation after the connection has been closed"); } ! } else if (concreteMethod.getName().equals(FINALIZE_METHOD)) { super.finalize(); ! } else if (concreteMethod.getName().equals(TO_STRING_METHOD)) { result = toString(); } else { if (proxyConnection != null) { ! if (concreteMethod.getName().startsWith(ConnectionResetter.MUTATOR_PREFIX)) { proxyConnection.setNeedToReset(true); } ! result = concreteMethod.invoke(proxyConnection.getConnection(), args); } else { ! throw new SQLException("You can't perform a " + concreteMethod.getName() + " operation after the connection has been closed"); } } *************** *** 161,165 **** throw e.getTargetException(); } catch (SQLException e) { ! throw new SQLException("Couldn't perform the operation " + method.getName()); } catch (Exception e) { LOG.error("Unexpected invocation exception", e); --- 167,171 ---- 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); *************** *** 199,204 **** if (obj instanceof Connection) { final WrappedConnection wc = ProxyFactory.getWrappedConnection((Connection) obj); ! if (wc != null) { ! return wc.hashCode() == hashCode(); } else { return false; --- 205,210 ---- if (obj instanceof Connection) { final WrappedConnection wc = ProxyFactory.getWrappedConnection((Connection) obj); ! if (wc != null && wc.getId() > 0 && getId() > 0) { ! return wc.getId() == getId(); } else { return false; *************** *** 223,226 **** --- 229,235 ---- Revision history: $Log$ + Revision 1.2 2004/06/02 20:50:47 billhorsman + Dropped obsolete InvocationHandler reference and injectable interface stuff. + Revision 1.1 2004/03/23 21:19:45 billhorsman Added disposable wrapper to proxied connection. And made proxied objects implement delegate interfaces too. |
From: <bil...@us...> - 2004-06-02 20:48:23
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19455/src/java/org/logicalcobwebs/proxool Modified Files: ProxyStatement.java Log Message: Dropped obsolete InvocationHandler reference. Index: ProxyStatement.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxyStatement.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ProxyStatement.java 12 Dec 2003 19:29:47 -0000 1.25 --- ProxyStatement.java 2 Jun 2004 20:48:14 -0000 1.26 *************** *** 26,30 **** * @author $Author$ (current maintainer) */ ! class ProxyStatement extends AbstractProxyStatement implements InvocationHandler, MethodInterceptor { private static final Log LOG = LogFactory.getLog(ProxyStatement.class); --- 26,30 ---- * @author $Author$ (current maintainer) */ ! class ProxyStatement extends AbstractProxyStatement implements MethodInterceptor { private static final Log LOG = LogFactory.getLog(ProxyStatement.class); *************** *** 136,139 **** --- 136,142 ---- Revision history: $Log$ + Revision 1.26 2004/06/02 20:48:14 billhorsman + Dropped obsolete InvocationHandler reference. + Revision 1.25 2003/12/12 19:29:47 billhorsman Now uses Cglib 2.0 |
From: <bil...@us...> - 2004-06-02 20:47:13
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19266/src/java/org/logicalcobwebs/proxool Modified Files: ProxoolFacade.java Log Message: Override shutdown with a zero-parameter version for Spring integration. Index: ProxoolFacade.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxoolFacade.java,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** ProxoolFacade.java 26 Mar 2004 15:58:56 -0000 1.79 --- ProxoolFacade.java 2 Jun 2004 20:47:05 -0000 1.80 *************** *** 192,195 **** --- 192,205 ---- /** * Removes all connection pools. Kills all the connections. Resets everything. + * Like {@link #shutdown(java.lang.String, int)} but passes the current thread name + * and a delay of zero. + */ + public static void shutdown() { + shutdown(Thread.currentThread().getName(), 0); + } + + /** + * Removes all connection pools. Kills all the connections. Resets everything. + * Like {@link #shutdown(java.lang.String, int)} but passes the current thread name. * @param delay the time to wait for connections to become inactive before killing it (milliseconds) */ *************** *** 791,794 **** --- 801,807 ---- Revision history: $Log$ + Revision 1.80 2004/06/02 20:47:05 billhorsman + Override shutdown with a zero-parameter version for Spring integration. + Revision 1.79 2004/03/26 15:58:56 billhorsman Fixes to ensure that house keeper and prototyper threads finish after shutdown. |
From: <bil...@us...> - 2004-06-02 20:44:02
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18586/src/java/org/logicalcobwebs/proxool/proxy Added Files: InvokerFacade.java MethodMapper.java Log Message: New classes to support injectable interfaces --- NEW FILE: InvokerFacade.java --- /* * This software is released under a licence similar to the Apache Software Licence. * See org.logicalcobwebs.proxool.package.html for details. * The latest version is available at http://proxool.sourceforge.net */ package org.logicalcobwebs.proxool.proxy; import org.logicalcobwebs.proxool.ProxoolException; import java.util.Map; import java.util.HashMap; import java.lang.reflect.Method; /** * Invokes a method using a cached method. * @version $Revision: 1.1 $, $Date: 2004/06/02 20:43:53 $ * @author billhorsman * @author $Author: billhorsman $ (current maintainer) * @since Proxool 0.9 */ public class InvokerFacade { private static Map methodMappers = new HashMap(); /** * Returns the method in the concrete class with an indentical signature to that passed * @param concreteClass the class that we want to invoke methods on. It should either implement all methods on * the injectable interface, or provide methods with an identical signature. * @param injectableMethod provides signature that we are trying to match * @return the method in the concrete class that we can invoke as if it were in the interface * @throws org.logicalcobwebs.proxool.ProxoolException if the method is not found. */ public static Method getConcreteMethod(Class concreteClass, Method injectableMethod) throws ProxoolException { Object key = concreteClass.getName() + ":" + injectableMethod.getName(); MethodMapper methodMapper = (MethodMapper) methodMappers.get(key); if (methodMapper == null) { methodMapper = new MethodMapper(concreteClass); methodMappers.put(key, methodMapper); } return methodMapper.getConcreteMethod(injectableMethod); } } /* Revision history: $Log: InvokerFacade.java,v $ Revision 1.1 2004/06/02 20:43:53 billhorsman New classes to support injectable interfaces */ --- NEW FILE: MethodMapper.java --- /* * This software is released under a licence similar to the Apache Software Licence. * See org.logicalcobwebs.proxool.package.html for details. * The latest version is available at http://proxool.sourceforge.net */ package org.logicalcobwebs.proxool.proxy; import org.logicalcobwebs.proxool.ProxoolException; import java.lang.reflect.Method; import java.util.Map; import java.util.HashMap; /** * Handles the mapping between methods with identical signatures but that are not related * by inheritance. This allows you to invoke a method on a class using an interface that * it doesn't actually implement. It caches the result of its reflective lookup to save time. * If the concreteClass does in fact implement the injectable interface then it quickly * returns the method without the penalty of mapping using reflection. * * @author <a href="mailto:bi...@lo...">Bill Horsman</a> * @author $Author: billhorsman $ (current maintainer) * @version $Revision: 1.1 $, $Date: 2004/06/02 20:43:53 $ * @since Proxool 0.9 */ public class MethodMapper { private Class concreteClass; private Map cachedConcreteMethods = new HashMap(); ; /** * @param concreteClass the class that we want to invoke methods on. It should either implement all methods on * the injectable interface, or provide methods with an identical signature. */ public MethodMapper(Class concreteClass) { this.concreteClass = concreteClass; } /** * Returns the method in the concrete class with an indentical signature to that passed * as a parameter * * @param injectableMethod provides signature that we are trying to match * @return the method in the concrete class that we can invoke as if it were in the interface * @throws org.logicalcobwebs.proxool.ProxoolException * if the method is not found. */ protected Method getConcreteMethod(Method injectableMethod) throws ProxoolException { // Do we have a cached reference? Method concreteMethod = (Method) cachedConcreteMethods.get(injectableMethod); if (concreteMethod == null) { // Look it up Method[] candidateMethods = concreteClass.getMethods(); for (int i = 0; i < candidateMethods.length; i++) { Method candidateMethod = candidateMethods[i]; // First pass: does the name, parameter count and return type match? if (candidateMethod.getName().equals(injectableMethod.getName()) && candidateMethod.getParameterTypes().length == injectableMethod.getParameterTypes().length && candidateMethod.getReturnType().equals(injectableMethod.getReturnType())) { // Let's check each parameter type boolean matches = true; Class[] candidateTypes = candidateMethod.getParameterTypes(); Class[] injectableTypes = injectableMethod.getParameterTypes(); for (int j = 0; j < candidateTypes.length; j++) { if (!candidateTypes[j].equals(injectableTypes[j])) { matches = false; break; } } if (matches) { concreteMethod = candidateMethod; break; } } } // Success? if (concreteMethod == null) { throw new ProxoolException("Couldn't match injectable method " + injectableMethod + " with any of those " + "found in " + concreteClass.getName()); } // Remember it cachedConcreteMethods.put(injectableMethod, concreteMethod); } return concreteMethod; } } /* Revision history: $Log: MethodMapper.java,v $ Revision 1.1 2004/06/02 20:43:53 billhorsman New classes to support injectable interfaces */ |
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/cglib/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18037/src/java/org/logicalcobwebs/cglib/proxy Modified Files: CallbackFilter.java CallbackGenerator.java Enhancer.java EnhancerEmitter.java MethodProxy.java NoOp.java Log Message: Updated cglib code. Index: CallbackFilter.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/cglib/proxy/CallbackFilter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CallbackFilter.java 17 Dec 2003 21:10:35 -0000 1.2 --- CallbackFilter.java 2 Jun 2004 20:41:53 -0000 1.3 *************** *** 64,71 **** public interface CallbackFilter { /** * Map a method to a callback. * @param method the intercepted method ! * @return the index into the array of callbacks (as specified by {@link Enhancer#setCallbacks}) to use for the method, */ int accept(Method method); --- 64,86 ---- public interface CallbackFilter { + static final CallbackFilter ALL_ZERO = new CallbackFilter() { + public int accept(Method method) { + return 0; + } + + public String toString() { + return "ALL_ZERO"; + } + + public int hashCode() { + return 999; + } + }; + /** * Map a method to a callback. + * * @param method the intercepted method ! * @return the index into the array of callbacks (as specified by {@link Enhancer#setCallbacks}) to use for the method, */ int accept(Method method); *************** *** 77,81 **** * <code>hashCode</code> for custom <code>CallbackFilter</code> * implementations in order to improve performance. ! */ boolean equals(Object o); } --- 92,96 ---- * <code>hashCode</code> for custom <code>CallbackFilter</code> * implementations in order to improve performance. ! */ boolean equals(Object o); } Index: CallbackGenerator.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/cglib/proxy/CallbackGenerator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CallbackGenerator.java 17 Dec 2003 21:10:35 -0000 1.2 --- CallbackGenerator.java 2 Jun 2004 20:41:54 -0000 1.3 *************** *** 56,65 **** import org.logicalcobwebs.cglib.core.ClassEmitter; import org.logicalcobwebs.cglib.core.CodeEmitter; - import org.logicalcobwebs.cglib.core.Context; ! interface CallbackGenerator ! { void generate(ClassEmitter e, Context context) throws Exception; void generateStatic(CodeEmitter e, Context context) throws Exception; } --- 56,81 ---- import org.logicalcobwebs.cglib.core.ClassEmitter; import org.logicalcobwebs.cglib.core.CodeEmitter; ! import java.lang.reflect.Method; ! import java.util.Iterator; ! ! interface CallbackGenerator { ! void generate(ClassEmitter e, Context context) throws Exception; + void generateStatic(CodeEmitter e, Context context) throws Exception; + interface Context { + + Iterator getMethods(); + + int getIndex(Method method); + + void emitCallback(CodeEmitter e, int index); + + int getModifiers(Method method); + + String getUniqueName(Method method); + } + } Index: Enhancer.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/cglib/proxy/Enhancer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Enhancer.java 17 Dec 2003 21:10:35 -0000 1.2 --- Enhancer.java 2 Jun 2004 20:41:54 -0000 1.3 *************** *** 94,109 **** { - static final CallbackFilter ALL_ZERO = new CallbackFilter() { - public int accept(Method method) { - return 0; - } - public String toString() { - return "ALL_ZERO"; - } - public int hashCode() { - return 999; - } - }; - private static final Source SOURCE = new Source(Enhancer.class.getName()); private static final EnhancerKey KEY_FACTORY = --- 94,97 ---- *************** *** 332,336 **** throw new IllegalStateException("Multiple callback types possible but no filter specified"); } ! filter = ALL_ZERO; } --- 320,324 ---- throw new IllegalStateException("Multiple callback types possible but no filter specified"); } ! filter = CallbackFilter.ALL_ZERO; } Index: EnhancerEmitter.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/cglib/proxy/EnhancerEmitter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EnhancerEmitter.java 17 Dec 2003 21:10:35 -0000 1.2 --- EnhancerEmitter.java 2 Jun 2004 20:41:54 -0000 1.3 *************** *** 403,407 **** seenGen.add(gen); final List fmethods = (List)groups.get(gen); ! Context context = new Context() { public Iterator getMethods() { return fmethods.iterator(); --- 403,407 ---- seenGen.add(gen); final List fmethods = (List)groups.get(gen); ! CallbackGenerator.Context context = new CallbackGenerator.Context() { public Iterator getMethods() { return fmethods.iterator(); Index: MethodProxy.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/cglib/proxy/MethodProxy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MethodProxy.java 17 Dec 2003 21:10:35 -0000 1.2 --- MethodProxy.java 2 Jun 2004 20:41:54 -0000 1.3 *************** *** 81,84 **** --- 81,123 ---- /** + * For internal use by {@link Enhancer} only; see the {@link net.sf.cglib.reflect.FastMethod} class + * for similar functionality. + */ + public static MethodProxy create(ClassLoader loader, Class c1, Class c2, String desc, String name1, String name2) { + final Signature sig1 = new Signature(name1, desc); + Signature sig2 = new Signature(name2, desc); + FastClass f1 = helper(loader, c1); + FastClass f2 = helper(loader, c2); + int i1 = f1.getIndex(sig1); + int i2 = f2.getIndex(sig2); + + MethodProxy proxy; + if (i1 < 0) { + proxy = new MethodProxy() { + public Object invoke(Object obj, Object[] args) throws Throwable { + throw new IllegalArgumentException("Protected method: " + sig1); + } + }; + } else { + proxy = new MethodProxy(); + } + + proxy.f1 = f1; + proxy.f2 = f2; + proxy.i1 = i1; + proxy.i2 = i2; + proxy.sig = sig1; + proxy.superName = name2; + return proxy; + } + + private static FastClass helper(ClassLoader loader, Class type) { + FastClass.Generator g = new FastClass.Generator(); + g.setType(type); + g.setClassLoader(loader); + return g.create(); + } + + /** * Return the signature of the proxied method. */ Index: NoOp.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/cglib/proxy/NoOp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NoOp.java 17 Dec 2003 21:10:35 -0000 1.2 --- NoOp.java 2 Jun 2004 20:41:54 -0000 1.3 *************** *** 60,62 **** --- 60,66 ---- public interface NoOp extends Callback { + /** + * A thread-safe singleton instance of the <code>NoOp</code> callback. + */ + public static final NoOp INSTANCE = new NoOp() { }; } |
From: <bil...@us...> - 2004-06-02 20:41:21
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17870/src/java/org/logicalcobwebs/proxool Modified Files: ProxoolDriver.java Log Message: Don't log SQLExceptions. Leave that up to the client. Index: ProxoolDriver.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxoolDriver.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ProxoolDriver.java 16 Oct 2003 18:53:21 -0000 1.26 --- ProxoolDriver.java 2 Jun 2004 20:41:13 -0000 1.27 *************** *** 90,94 **** } catch (SQLException e) { ! LOG.error("Problem", e); // Check to see if it's fatal. We might need to wrap it up. try { --- 90,95 ---- } catch (SQLException e) { ! // We don't log exceptions. Leave that up to the client. ! // LOG.error("Problem", e); // Check to see if it's fatal. We might need to wrap it up. try { *************** *** 226,229 **** --- 227,233 ---- Revision history: $Log$ + Revision 1.27 2004/06/02 20:41:13 billhorsman + Don't log SQLExceptions. Leave that up to the client. + Revision 1.26 2003/10/16 18:53:21 billhorsman When registering a new pool on the fly, indicate that it is implicit (for exception message handling) |
From: <bil...@us...> - 2004-06-02 20:39:25
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17226/src/java/org/logicalcobwebs/proxool Modified Files: ProxoolConstants.java Log Message: New injectable interface constants Index: ProxoolConstants.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ProxoolConstants.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ProxoolConstants.java 15 Mar 2004 02:43:47 -0000 1.20 --- ProxoolConstants.java 2 Jun 2004 20:39:17 -0000 1.21 *************** *** 132,135 **** --- 132,159 ---- public final String MAXIMUM_ACTIVE_TIME_PROPERTY = PROPERTY_PREFIX + MAXIMUM_ACTIVE_TIME; + /** @see #INJECTABLE_CONNECTION_INTERFACE_NAME_PROPERTY */ + public final String INJECTABLE_CONNECTION_INTERFACE_NAME = "injectable-connection-interface"; + + /** @see ProxoolDriver#getPropertyInfo */ + public final String INJECTABLE_CONNECTION_INTERFACE_NAME_PROPERTY = PROPERTY_PREFIX + INJECTABLE_CONNECTION_INTERFACE_NAME; + + /** @see #INJECTABLE_STATEMENT_INTERFACE_NAME_PROPERTY */ + public final String INJECTABLE_STATEMENT_INTERFACE_NAME = "injectable-statement-interface"; + + /** @see ProxoolDriver#getPropertyInfo */ + public final String INJECTABLE_STATEMENT_INTERFACE_NAME_PROPERTY = PROPERTY_PREFIX + INJECTABLE_STATEMENT_INTERFACE_NAME; + + /** @see #INJECTABLE_PREPARED_STATEMENT_INTERFACE_NAME_PROPERTY */ + public final String INJECTABLE_PREPARED_STATEMENT_INTERFACE_NAME = "injectable-prepared-statement-interface"; + + /** @see ProxoolDriver#getPropertyInfo */ + public final String INJECTABLE_PREPARED_STATEMENT_INTERFACE_NAME_PROPERTY = PROPERTY_PREFIX + INJECTABLE_PREPARED_STATEMENT_INTERFACE_NAME; + + /** @see #INJECTABLE_CALLABLE_STATEMENT_INTERFACE_NAME_PROPERTY */ + public final String INJECTABLE_CALLABLE_STATEMENT_INTERFACE_NAME = "injectable-callable-statement-interface"; + + /** @see ProxoolDriver#getPropertyInfo */ + public final String INJECTABLE_CALLABLE_STATEMENT_INTERFACE_NAME_PROPERTY = PROPERTY_PREFIX + INJECTABLE_CALLABLE_STATEMENT_INTERFACE_NAME; + /** * @deprecated use {@link #VERBOSE_PROPERTY verbose} instead. *************** *** 241,244 **** --- 265,271 ---- Revision history: $Log$ + Revision 1.21 2004/06/02 20:39:17 billhorsman + New injectable interface constants + Revision 1.20 2004/03/15 02:43:47 chr32 Removed explicit JNDI properties. Going for a generic approach instead. |
From: <bil...@us...> - 2004-06-02 20:38:40
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17044/src/java/org/logicalcobwebs/proxool Modified Files: HouseKeeperController.java Log Message: More robust round robin of house keepers. Index: HouseKeeperController.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/HouseKeeperController.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HouseKeeperController.java 26 Mar 2004 15:58:56 -0000 1.4 --- HouseKeeperController.java 2 Jun 2004 20:38:32 -0000 1.5 *************** *** 52,64 **** synchronized (LOCK) { for (int i = 0; i < houseKeeperList.size(); i++) { ! if (houseKeeperIndex > houseKeeperList.size() - 1) { houseKeeperIndex = 0; } - HouseKeeper hk = (HouseKeeper) houseKeeperList.get(houseKeeperIndex); - houseKeeperIndex++; - if (hk.isSweepDue()) { - houseKeeper = hk; - break; - } } } --- 52,66 ---- synchronized (LOCK) { for (int i = 0; i < houseKeeperList.size(); i++) { ! HouseKeeper hk = null; ! try { ! hk = (HouseKeeper) houseKeeperList.get(houseKeeperIndex); ! if (hk.isSweepDue()) { ! houseKeeper = hk; ! break; ! } ! houseKeeperIndex++; ! } catch (IndexOutOfBoundsException e) { houseKeeperIndex = 0; } } } *************** *** 129,132 **** --- 131,137 ---- Revision history: $Log$ + Revision 1.5 2004/06/02 20:38:32 billhorsman + More robust round robin of house keepers. + Revision 1.4 2004/03/26 15:58:56 billhorsman Fixes to ensure that house keeper and prototyper threads finish after shutdown. |