fmeheust commented on code in PR #677: URL: https://github.com/apache/tomcat/pull/677#discussion_r1384572235
########## modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java: ########## @@ -812,6 +829,28 @@ protected PooledConnection createConnection(long now, PooledConnection notUsed, }//catch } + /** + * If request boundaries are not initialised, checks if beginRequest and + * endRequest methods are implemented on connection object. + * + * @param connection The connection + * @return Returns true if connection is not null and connection implements + * JDBC 4.3 beginRequest and endRequest methods + */ + private boolean hasRequestBoundaryMethods(Connection connection) { + if (!requestBoundaryMethodsInitialised && connection != null) { + try { + beginRequest = connection.getClass().getMethod("beginRequest"); + endRequest = connection.getClass().getMethod("endRequest"); + } catch (NoSuchMethodException ex) { + // begin and end request not implemented, ignore exception + } finally { + requestBoundaryMethodsInitialised = true; Review Comment: I have changed the code and moved the code to a static block. The getMethod call is now made on the java.sql.Connection interface and not on the instance if the underlying connection, with this solution request boundaries are only called if the version of java is 9 or later. I have changed the tests accordingly. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org