You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/02/25 16:21:44 UTC

[GitHub] [commons-pool] JSurf opened a new pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

JSurf opened a new pull request #67:
URL: https://github.com/apache/commons-pool/pull/67


   Hi, we have added AbandonedConfig for GenericKeyedObjectPool. 
   Would be nice to see this in the next official release
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] garydgregory commented on a change in pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#discussion_r583644635



##########
File path: src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
##########
@@ -267,6 +272,25 @@ public GenericKeyedObjectPool(final KeyedPooledObjectFactory<K, T> factory,
         setConfig(config);
     }
 
+    /**
+     * Creates a new {@code GenericKeyedObjectPool} that tracks and destroys
+     * objects that are checked out, but never returned to the pool.
+     *
+     * @param factory   The object factory to be used to create object instances
+     *                  used by this pool
+     * @param config    The base pool configuration to use for this pool instance.
+     *                  The configuration is used by value. Subsequent changes to
+     *                  the configuration object will not be reflected in the
+     *                  pool.
+     * @param abandonedConfig  Configuration for abandoned object identification
+     *                         and removal.  The configuration is used by value.
+     */

Review comment:
       Just reviewing details: Please add `@since` tags to new public and protected methods.

##########
File path: src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolMXBean.java
##########
@@ -91,6 +91,12 @@
      */
     boolean getLifo();
 
+    /**

Review comment:
       You MUST use default methods when adding to an interface in order to preserve binary compatibility.
   




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] psteitz commented on pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
psteitz commented on pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#issuecomment-804294893


   Looking at this again, I think both outer and inner loops are OK, using iterators that won't fail from CHM.  So this looks good to merge to me.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] JSurf commented on a change in pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
JSurf commented on a change in pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#discussion_r584850432



##########
File path: src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolMXBean.java
##########
@@ -91,6 +91,12 @@
      */
     boolean getLifo();
 
+    /**

Review comment:
       Added default methods to the newly added methods




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] coveralls edited a comment on pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#issuecomment-786557207


   
   [![Coverage Status](https://coveralls.io/builds/37481680/badge)](https://coveralls.io/builds/37481680)
   
   Coverage decreased (-0.04%) to 84.106% when pulling **619a5a9502191bd2e414b592adf5f396f8088e81 on vitecde:abandonkeyed** into **a468ef3eae85043f58dc8e8fcb296058c8fe2ccf on apache:master**.
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] psteitz edited a comment on pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
psteitz edited a comment on pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#issuecomment-803663669


   Sorry for taking so long to review this.  Looks good to me.  Thanks and nice work.  I only have one comment.  The iteration in the top loop in removeAbandoned is over poolMap.entrySet.  This set may be modified during execution of the loop (due to adding / dropping keyed pools).  I am not sure the behavior will be consistent / predictable in all cases.  Could be I am wrong on this in which case this comment can be ignored.  It might be better to take some kind of snapshot at the top of the loop.   I don't think any additional sync is needed (beyond what you have using the victims' monitors), and if the loop behaves predictably (skipping removals, possibly missing adds), the current code is OK.  Missing adds is not likely a problem since instances in new pools are not likely to have timed out and skipping removals similarly is no problem, since pools don't get dropped unless they are empty.  I am just worried about strange things happening due to behavior being undefined. 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] coveralls edited a comment on pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#issuecomment-786557207


   
   [![Coverage Status](https://coveralls.io/builds/37543468/badge)](https://coveralls.io/builds/37543468)
   
   Coverage increased (+0.02%) to 84.169% when pulling **39bb7060d4d2fb364609d4bdd76f0d8019d0b974 on vitecde:abandonkeyed** into **601ccec66fec2f8daee019f86420f8e1ca69136f on apache:master**.
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] JSurf commented on a change in pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
JSurf commented on a change in pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#discussion_r583686761



##########
File path: src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
##########
@@ -267,6 +272,25 @@ public GenericKeyedObjectPool(final KeyedPooledObjectFactory<K, T> factory,
         setConfig(config);
     }
 
+    /**
+     * Creates a new {@code GenericKeyedObjectPool} that tracks and destroys
+     * objects that are checked out, but never returned to the pool.
+     *
+     * @param factory   The object factory to be used to create object instances
+     *                  used by this pool
+     * @param config    The base pool configuration to use for this pool instance.
+     *                  The configuration is used by value. Subsequent changes to
+     *                  the configuration object will not be reflected in the
+     *                  pool.
+     * @param abandonedConfig  Configuration for abandoned object identification
+     *                         and removal.  The configuration is used by value.
+     */

Review comment:
       Added `@since` tags




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] garydgregory merged pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
garydgregory merged pull request #67:
URL: https://github.com/apache/commons-pool/pull/67


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] JSurf commented on a change in pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
JSurf commented on a change in pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#discussion_r583672713



##########
File path: src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolMXBean.java
##########
@@ -91,6 +91,12 @@
      */
     boolean getLifo();
 
+    /**

Review comment:
       Could easily do, but the class had already a comment that this interface is subject to change:
   
   ```
    * NOTE: This interface exists only to define those attributes and methods that
    *       will be made available via JMX. It must not be implemented by clients
    *       as it is subject to change between major, minor and patch version
    *       releases of commons pool. Clients that implement this interface may
    *       not, therefore, be able to upgrade to a new minor or patch release
    *       without requiring code changes.
   
   ```




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] JSurf commented on a change in pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
JSurf commented on a change in pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#discussion_r583686761



##########
File path: src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
##########
@@ -267,6 +272,25 @@ public GenericKeyedObjectPool(final KeyedPooledObjectFactory<K, T> factory,
         setConfig(config);
     }
 
+    /**
+     * Creates a new {@code GenericKeyedObjectPool} that tracks and destroys
+     * objects that are checked out, but never returned to the pool.
+     *
+     * @param factory   The object factory to be used to create object instances
+     *                  used by this pool
+     * @param config    The base pool configuration to use for this pool instance.
+     *                  The configuration is used by value. Subsequent changes to
+     *                  the configuration object will not be reflected in the
+     *                  pool.
+     * @param abandonedConfig  Configuration for abandoned object identification
+     *                         and removal.  The configuration is used by value.
+     */

Review comment:
       Added @since tags




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] JSurf commented on a change in pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
JSurf commented on a change in pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#discussion_r583672713



##########
File path: src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolMXBean.java
##########
@@ -91,6 +91,12 @@
      */
     boolean getLifo();
 
+    /**

Review comment:
       Could easily do, but the class had already a comment that this interface is subject to change:
   
    * NOTE: This interface exists only to define those attributes and methods that
    *       will be made available via JMX. It must not be implemented by clients
    *       as it is subject to change between major, minor and patch version
    *       releases of commons pool. Clients that implement this interface may
    *       not, therefore, be able to upgrade to a new minor or patch release
    *       without requiring code changes.
   




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] garydgregory commented on a change in pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#discussion_r583830801



##########
File path: src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolMXBean.java
##########
@@ -91,6 +91,12 @@
      */
     boolean getLifo();
 
+    /**

Review comment:
       Sure, but I bet this comment was written pre-Java 8 so I think you can drop that comment when you add default methods.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] coveralls edited a comment on pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#issuecomment-786557207


   
   [![Coverage Status](https://coveralls.io/builds/37483368/badge)](https://coveralls.io/builds/37483368)
   
   Coverage increased (+0.05%) to 84.201% when pulling **8a36d9b770efabdd4a6459f929346a8aa6a4195c on vitecde:abandonkeyed** into **a468ef3eae85043f58dc8e8fcb296058c8fe2ccf on apache:master**.
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] coveralls commented on pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#issuecomment-786557207


   
   [![Coverage Status](https://coveralls.io/builds/37476495/badge)](https://coveralls.io/builds/37476495)
   
   Coverage decreased (-0.08%) to 84.066% when pulling **4edad40a26b482f43126e395d3154e436e2f97d7 on vitecde:abandonkeyed** into **a468ef3eae85043f58dc8e8fcb296058c8fe2ccf on apache:master**.
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] JSurf commented on pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
JSurf commented on pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#issuecomment-803868476


   @psteitz Thats an interesting question. From what I understand ConcurrentHashMap seems at least make sure that the iterator itself does not fail and already does some kind of "snapshot" behaviour. It may or may not show concurrent changes depending on the implementation but it should not fail
   
   https://stackoverflow.com/questions/3768554/is-iterating-concurrenthashmap-values-thread-safe


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-pool] psteitz commented on pull request #67: Implement AbandonedConfig for GenericKeyedObjectPool

Posted by GitBox <gi...@apache.org>.
psteitz commented on pull request #67:
URL: https://github.com/apache/commons-pool/pull/67#issuecomment-803663669


   Sorry for taking so long to review this.  Looks good to me.  Thanks and nice work.  I only have one comment.  The iteration in the top loop in removeAbandoned is over poolMap.entrySet.  This set is may be modified during execution of the loop (due to adding / dropping keyed pools).  I am not sure the behavior will be consistent / predictable in all cases.  Could be I am wrong on this in which case this commend can be ignored.  It might be better to take some kind of snapshot at the top of the loop.   I don't think any additional sync is needed (beyond what you have using the victims' monitors), and if the loop behaves predictably (skipping removals, possibly missing adds), the current code is OK.  Missing adds is not likely a problem since instances in new pools are not likely to have timed out and skipping removals similarly is no problem, since pools don't get dropped unless they are empty.  I am just worried about strange things happening due to behavior being undefined. 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org