garydgregory commented on a change in pull request #32:
URL: https://github.com/apache/commons-pool/pull/32#discussion_r458807172



##########
File path: 
src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
##########
@@ -2996,4 +2909,24 @@ public void testWhenExhaustedFail() throws Exception {
         genericObjectPool.close();
     }
 
+    /**
+     * Check that a pool that starts an evictor, but is never closed does not
+     * leave EvictionTimer executor running. Confirmation check is in teardown.
+     */
+    @Test
+    public void testAbandonedPool() throws Exception {
+        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
+        config.setJmxEnabled(false);
+        GenericObjectPool<String> abandoned = new 
GenericObjectPool<>(simpleFactory, config);
+        abandoned.setTimeBetweenEvictionRunsMillis(100); // Starts evictor
+
+        // This is ugly, but forces gc to hit the pool

Review comment:
       Note that calling gc() might do nothing, it is only a "suggestion" to 
the VM.




----------------------------------------------------------------
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:
[email protected]


Reply via email to