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 2023/03/05 13:25:24 UTC

[commons-pool] branch master updated (92499d61 -> 5a284d64)

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


    from 92499d61 [POOL-411] NPE when deregistering key at end of borrow
     new 1416ce45 Make private class GenericKeyedObjectPool.ObjectDeque class static
     new 3478447f Make private class BaseGenericObjectPool.StatsStore class static
     new 1003a9f9 Use final
     new 2ce623f5 Remove trailing whitespace
     new 36969735 Remove trailing whitespace
     new e09e4c85 Make private test class static
     new 5a284d64 Make private test class static

The 7 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:
 src/changes/changes.xml                                           | 4 ++++
 src/main/java/org/apache/commons/pool2/PooledObject.java          | 2 +-
 .../java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java | 2 +-
 .../org/apache/commons/pool2/impl/GenericKeyedObjectPool.java     | 8 ++++----
 src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java    | 6 +++---
 .../org/apache/commons/pool2/pool407/Pool407NormalFactory.java    | 2 +-
 .../commons/pool2/pool407/Pool407NullPoolableObjectFactory.java   | 2 +-
 7 files changed, 15 insertions(+), 11 deletions(-)


[commons-pool] 04/07: Remove trailing whitespace

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

commit 2ce623f5bc168bd7a16e9e9761b1e3536742d742
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 5 08:11:04 2023 -0500

    Remove trailing whitespace
---
 .../java/org/apache/commons/pool2/pool407/Pool407NormalFactory.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/pool2/pool407/Pool407NormalFactory.java b/src/test/java/org/apache/commons/pool2/pool407/Pool407NormalFactory.java
index 8ade79a4..03ade541 100644
--- a/src/test/java/org/apache/commons/pool2/pool407/Pool407NormalFactory.java
+++ b/src/test/java/org/apache/commons/pool2/pool407/Pool407NormalFactory.java
@@ -35,7 +35,7 @@ public final class Pool407NormalFactory extends AbstractPool407Factory {
     public Pool407Fixture create() {
         // When this returns null, we fail-fast internally and borrowsObject() throws an exception.
         //
-        // Old note: 
+        // Old note:
         // This is key to the test, creation failed and returns null for instance see
         // https://github.com/openhab/openhab-core/blob/main/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/pooling/ModbusSlaveConnectionFactoryImpl.java#L163
         // the test passes when this returns new Pool407Fixture();


[commons-pool] 02/07: Make private class BaseGenericObjectPool.StatsStore class static

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

commit 3478447f1fc0714c8eb756d2b6c11b1d104fe93d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 5 08:10:23 2023 -0500

    Make private class BaseGenericObjectPool.StatsStore class static
---
 src/changes/changes.xml                                                | 1 +
 src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 447d43dd..7ffe9014 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -80,6 +80,7 @@ The <action> type attribute can be add,update,fix,remove.
     </action>
     <action dev="ggregory" type="fix" due-to="Gary Gregory">
       Make private class GenericKeyedObjectPool.ObjectDeque class static.
+      Make private class BaseGenericObjectPool.StatsStore class static.      
     </action>
     <!-- ADD -->
     <action dev="ggregory" type="add" due-to="Gary Gregory">
diff --git a/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
index f5bf4f4e..8bef3bc1 100644
--- a/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
+++ b/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
@@ -251,7 +251,7 @@ public abstract class BaseGenericObjectPool<T, E extends Exception> extends Base
      * Maintains a cache of values for a single metric and reports
      * statistics on the cached values.
      */
-    private class StatsStore {
+    private static class StatsStore {
 
         private static final int NULL = -1;
         private final AtomicLong[] values;


[commons-pool] 01/07: Make private class GenericKeyedObjectPool.ObjectDeque class static

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

commit 1416ce453d35e60bece2cd06f5af86f70b3b16e3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 5 08:09:43 2023 -0500

    Make private class GenericKeyedObjectPool.ObjectDeque class static
---
 src/changes/changes.xml                                           | 3 +++
 .../org/apache/commons/pool2/impl/GenericKeyedObjectPool.java     | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1d21c8d3..447d43dd 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -78,6 +78,9 @@ The <action> type attribute can be add,update,fix,remove.
     <action dev="ggregory" type="fix" issue="POOL-411" due-to="Richard Eckart de Castilho, Gary Gregory">
       NPE when deregistering key at end of borrow.
     </action>
+    <action dev="ggregory" type="fix" due-to="Gary Gregory">
+      Make private class GenericKeyedObjectPool.ObjectDeque class static.
+    </action>
     <!-- ADD -->
     <action dev="ggregory" type="add" due-to="Gary Gregory">
       Add PooledObject.getFullDuration().
diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
index 17fb18df..2badcb31 100644
--- a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
+++ b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
@@ -96,7 +96,7 @@ public class GenericKeyedObjectPool<K, T, E extends Exception> extends BaseGener
      *
      * @param <S> type of objects in the pool
      */
-    private class ObjectDeque<S> {
+    private static class ObjectDeque<S> {
 
         private final LinkedBlockingDeque<PooledObject<S>> idleObjects;
 
@@ -440,7 +440,7 @@ public class GenericKeyedObjectPool<K, T, E extends Exception> extends BaseGener
                         try {
                             p = borrowMaxWaitMillis < 0 ? objectDeque.getIdleObjects().takeFirst() :
                                 objectDeque.getIdleObjects().pollFirst(borrowMaxWaitMillis, TimeUnit.MILLISECONDS);
-                        } catch (InterruptedException e) {
+                        } catch (final InterruptedException e) {
                             throw cast(e);
                         }
                     }
@@ -766,7 +766,7 @@ public class GenericKeyedObjectPool<K, T, E extends Exception> extends BaseGener
                         // the pool is at capacity or not.
                         try {
                             objectDeque.makeObjectCountLock.wait();
-                        } catch (InterruptedException e) {
+                        } catch (final InterruptedException e) {
                             throw cast(e);
                         }
                     }
@@ -1553,7 +1553,7 @@ public class GenericKeyedObjectPool<K, T, E extends Exception> extends BaseGener
         int maxQueueLength = 0;
         LinkedBlockingDeque<PooledObject<T>> mostLoaded = null;
         K loadedKey = null;
-        for (final Entry<K, GenericKeyedObjectPool<K, T, E>.ObjectDeque<T>> entry : poolMap.entrySet()) {
+        for (final Entry<K, GenericKeyedObjectPool.ObjectDeque<T>> entry : poolMap.entrySet()) {
             final K k = entry.getKey();
             final ObjectDeque<T> deque = entry.getValue();
             final LinkedBlockingDeque<PooledObject<T>> pool = deque.getIdleObjects();


[commons-pool] 06/07: Make private test class static

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

commit e09e4c85284e916fa29423112555ca8287bc68cc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 5 08:11:36 2023 -0500

    Make private test class static
---
 src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java b/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java
index f6ba49d0..0f86faab 100644
--- a/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java
+++ b/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java
@@ -52,7 +52,7 @@ public final class ObjectPoolIssue326 {
         }
     }
 
-    private class Task<E extends Exception> implements Callable<Object> {
+    private static class Task<E extends Exception> implements Callable<Object> {
         private final GenericKeyedObjectPool<Integer, Object, E> m_pool;
         private final int m_key;
 
@@ -89,7 +89,7 @@ public final class ObjectPoolIssue326 {
         }
     }
 
-    private class TestObject {
+    private static class TestObject {
     }
 
     public static void main(final String[] args) {


[commons-pool] 05/07: Remove trailing whitespace

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

commit 3696973582614a793500ffa42af5de0b0a28d9f1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 5 08:11:16 2023 -0500

    Remove trailing whitespace
---
 .../apache/commons/pool2/pool407/Pool407NullPoolableObjectFactory.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/pool2/pool407/Pool407NullPoolableObjectFactory.java b/src/test/java/org/apache/commons/pool2/pool407/Pool407NullPoolableObjectFactory.java
index 274057d2..3e54b965 100644
--- a/src/test/java/org/apache/commons/pool2/pool407/Pool407NullPoolableObjectFactory.java
+++ b/src/test/java/org/apache/commons/pool2/pool407/Pool407NullPoolableObjectFactory.java
@@ -23,7 +23,7 @@ import org.apache.commons.pool2.PooledObject;
  * Tests POOL-407.
  */
 public final class Pool407NullPoolableObjectFactory extends AbstractPool407Factory {
-    
+
     @Override
     public Pool407Fixture create() {
         return null;


[commons-pool] 07/07: Make private test class static

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

commit 5a284d64d1380968579cd91815119f1710ac67b2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 5 08:12:45 2023 -0500

    Make private test class static
---
 src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java b/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java
index 0f86faab..6e5d78a8 100644
--- a/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java
+++ b/src/test/java/org/apache/commons/pool2/ObjectPoolIssue326.java
@@ -40,7 +40,7 @@ import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig;
  * negatively since you need to run it for a while.
  */
 public final class ObjectPoolIssue326 {
-    private class ObjectFactory extends BaseKeyedPooledObjectFactory<Integer, Object, RuntimeException> {
+    private static class ObjectFactory extends BaseKeyedPooledObjectFactory<Integer, Object, RuntimeException> {
         @Override
         public Object create(final Integer s) {
             return new TestObject();


[commons-pool] 03/07: Use final

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

commit 1003a9f9a35cf8702b1cc2451c4f3bc5bc55b090
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 5 08:10:45 2023 -0500

    Use final
---
 src/main/java/org/apache/commons/pool2/PooledObject.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/pool2/PooledObject.java b/src/main/java/org/apache/commons/pool2/PooledObject.java
index fffcbc5b..6403d33b 100644
--- a/src/main/java/org/apache/commons/pool2/PooledObject.java
+++ b/src/main/java/org/apache/commons/pool2/PooledObject.java
@@ -40,7 +40,7 @@ public interface PooledObject<T> extends Comparable<PooledObject<T>> {
      * @return whether the given PooledObject is null <em>or</em> contains a null.
      * @since 2.12.0
      */
-    static boolean isNull(PooledObject<?> pooledObject) {
+    static boolean isNull(final PooledObject<?> pooledObject) {
         return pooledObject == null || pooledObject.getObject() == null;
     }