aooohan commented on code in PR #677:
URL: https://github.com/apache/tomcat/pull/677#discussion_r1384334368


##########
modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/ConnectionBoundariesTest.java:
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomcat.jdbc.test;
+
+import org.apache.tomcat.jdbc.test.driver.Driver;
+
+import java.sql.Connection;
+
+import org.junit.Test;
+import org.junit.Assert;
+
+public class ConnectionBoundariesTest extends DefaultTestCase {
+
+
+    @Override
+    public org.apache.tomcat.jdbc.pool.DataSource createDefaultDataSource() {
+        // TODO Auto-generated method stub
+        org.apache.tomcat.jdbc.pool.DataSource ds = 
super.createDefaultDataSource();
+        ds.getPoolProperties().setDriverClassName(Driver.class.getName());
+        ds.getPoolProperties().setUrl(Driver.url);
+        ds.getPoolProperties().setInitialSize(0);
+        ds.getPoolProperties().setMaxIdle(10);
+        ds.getPoolProperties().setMinIdle(10);
+        ds.getPoolProperties().setMaxActive(10);
+        return ds;
+    }
+    @Test
+    public void connectionWithRequestBoundariesTest() throws Exception {
+        
datasource.getPoolProperties().getDbProperties().setProperty("requestBoundaries",
 "true");

Review Comment:
   What does this parameter do, and where is it used?



##########
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:
   Maybe this block move to static block and assign to some static variables is 
better?



-- 
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

Reply via email to