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 2020/09/25 16:01:50 UTC

[commons-pool] branch master updated: Fix PMD issue.

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-pool.git


The following commit(s) were added to refs/heads/master by this push:
     new b1af9da  Fix PMD issue.
b1af9da is described below

commit b1af9daa2737686878bf7b004d9dec51357efbde
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Sep 25 12:01:45 2020 -0400

    Fix PMD issue.
---
 .../apache/commons/pool2/impl/EvictionTimer.java   | 23 +++++++++++-----------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java b/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java
index 8f0f04c..b4b7724 100644
--- a/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java
+++ b/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java
@@ -106,23 +106,22 @@ class EvictionTimer {
      * @param restarting The state of the evictor.
      */
     static synchronized void cancel(
-            final BaseGenericObjectPool<?>.Evictor evictor, final long timeout, final TimeUnit unit, final boolean restarting) {
+            final BaseGenericObjectPool<?>.Evictor evictor, final long timeout, final TimeUnit unit,
+            final boolean restarting) {
         if (evictor != null) {
             evictor.cancel();
             remove(evictor);
         }
-        if (!restarting && executor != null) {
-            if (taskMap.isEmpty()) {
-                executor.shutdown();
-                try {
-                    executor.awaitTermination(timeout, unit);
-                } catch (final InterruptedException e) {
-                    // Swallow
-                    // Significant API changes would be required to propagate this
-                }
-                executor.setCorePoolSize(0);
-                executor = null;
+        if (!restarting && executor != null && taskMap.isEmpty()) {
+            executor.shutdown();
+            try {
+                executor.awaitTermination(timeout, unit);
+            } catch (final InterruptedException e) {
+                // Swallow
+                // Significant API changes would be required to propagate this
             }
+            executor.setCorePoolSize(0);
+            executor = null;
         }
     }