You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/07/07 14:26:59 UTC

[commons-dbcp] branch master updated (f2981ff -> bcb9594)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git.


    from f2981ff  Bump spotbugs from 4.2.3 to 4.3.0 #117.
     new 3a510ad  Rename internal vars.
     new bcb9594  Be more quiet by default on the console during build tests.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/commons/dbcp2/DelegatingConnection.java | 32 +++++++++++-----------
 .../apache/commons/dbcp2/TestConnectionPool.java   | 17 ++++++++----
 2 files changed, 28 insertions(+), 21 deletions(-)

[commons-dbcp] 02/02: Be more quiet by default on the console during build tests.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git

commit bcb959486ef5d24980f567be6dca6126fc73b544
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jul 7 10:26:42 2021 -0400

    Be more quiet by default on the console during build tests.
---
 .../org/apache/commons/dbcp2/TestConnectionPool.java    | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
index 900eeb7..6141547 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestConnectionPool.java
@@ -804,13 +804,13 @@ public abstract class TestConnectionPool {
                     if (thrown != null) {
                         failed++;
                         if (!expectError || !(thrown instanceof SQLException)){
-                            System.out.println("Unexpected error: "+thrown.getMessage());
+                            System.err.println("Unexpected error: " + thrown.getMessage());
                         }
                     }
                 }
 
                 final long timeMillis = timeStampMillis() - startTimeMillis;
-                System.out.println("Multithread test time = " + timeMillis
+                println("Multithread test time = " + timeMillis
                         + " ms. Threads: " + pts.length
                         + ". Loops: " + loops
                         + ". Hold time: " + holdTime
@@ -823,10 +823,10 @@ public abstract class TestConnectionPool {
                 if (expectError) {
                     if (DISPLAY_THREAD_DETAILS || (pts.length/2 != failed)){
                         final long offset = pts[0].createdMillis - 1000; // To reduce size of output numbers, but ensure they have 4 digits
-                        System.out.println("Offset: "+offset);
+                        println("Offset: "+offset);
                         for (int i = 0; i < pts.length; i++) {
                             final PoolTest pt = pts[i];
-                            System.out.println(
+                            println(
                                     "Pre: " + (pt.preconnected-offset) // First, so can sort on this easily
                                     + ". Post: " + (pt.postconnected != 0 ? Long.toString(pt.postconnected-offset): "-")
                                     + ". Hash: " + pt.connHash
@@ -842,7 +842,7 @@ public abstract class TestConnectionPool {
                         }
                     }
                     if (didNotRun > 0){
-                        System.out.println("NOTE: some threads did not run the code: "+didNotRun);
+                        println("NOTE: some threads did not run the code: "+didNotRun);
                     }
                     // Perform initial sanity check:
                     assertTrue(failed > 0, "Expected some of the threads to fail");
@@ -852,6 +852,13 @@ public abstract class TestConnectionPool {
                     assertEquals(0, failed, "Did not expect any threads to fail");
                 }
             }
+    
+            void println(String string) {
+                if (Boolean.getBoolean(getClass().getSimpleName() + ".debug")) {
+                    System.out.println(string);
+                }
+            }
+
     private static int currentThreadCount;
 
     private static final String DONE = "Done";

[commons-dbcp] 01/02: Rename internal vars.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git

commit 3a510ad9f2d1ae40f4968e7945e6390aacb0cb11
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jul 7 09:10:37 2021 -0400

    Rename internal vars.
---
 .../apache/commons/dbcp2/DelegatingConnection.java | 32 +++++++++++-----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
index a9be933..1b41d44 100644
--- a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
@@ -69,8 +69,8 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
     private volatile boolean closed;
 
     private boolean cacheState = true;
-    private Boolean autoCommitCached;
-    private Boolean readOnlyCached;
+    private Boolean cachedAutoCommit;
+    private Boolean cachedReadOnly;
     private Integer defaultQueryTimeoutSeconds;
 
     /**
@@ -391,12 +391,12 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
     @Override
     public boolean getAutoCommit() throws SQLException {
         checkOpen();
-        if (cacheState && autoCommitCached != null) {
-            return autoCommitCached;
+        if (cacheState && cachedAutoCommit != null) {
+            return cachedAutoCommit;
         }
         try {
-            autoCommitCached = connection.getAutoCommit();
-            return autoCommitCached;
+            cachedAutoCommit = connection.getAutoCommit();
+            return cachedAutoCommit;
         } catch (final SQLException e) {
             handleException(e);
             return false;
@@ -461,12 +461,12 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
     @Override
     public boolean isReadOnly() throws SQLException {
         checkOpen();
-        if (cacheState && readOnlyCached != null) {
-            return readOnlyCached;
+        if (cacheState && cachedReadOnly != null) {
+            return cachedReadOnly;
         }
         try {
-            readOnlyCached = connection.isReadOnly();
-            return readOnlyCached;
+            cachedReadOnly = connection.isReadOnly();
+            return cachedReadOnly;
         } catch (final SQLException e) {
             handleException(e);
             return false;
@@ -530,8 +530,8 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
      * directly.
      */
     public void clearCachedState() {
-        autoCommitCached = null;
-        readOnlyCached = null;
+        cachedAutoCommit = null;
+        cachedReadOnly = null;
         if (connection instanceof DelegatingConnection) {
             ((DelegatingConnection<?>) connection).clearCachedState();
         }
@@ -543,10 +543,10 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
         try {
             connection.setAutoCommit(autoCommit);
             if (cacheState) {
-                autoCommitCached = connection.getAutoCommit();
+                cachedAutoCommit = connection.getAutoCommit();
             }
         } catch (final SQLException e) {
-            autoCommitCached = null;
+            cachedAutoCommit = null;
             handleException(e);
         }
     }
@@ -567,10 +567,10 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
         try {
             connection.setReadOnly(readOnly);
             if (cacheState) {
-                readOnlyCached = connection.isReadOnly();
+                cachedReadOnly = connection.isReadOnly();
             }
         } catch (final SQLException e) {
-            readOnlyCached = null;
+            cachedReadOnly = null;
             handleException(e);
         }
     }