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 2022/08/31 01:14:45 UTC

[commons-pool] branch master updated: Be a little more patient for slow builds

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 7951ee73 Be a little more patient for slow builds
     new 5b7586d1 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-pool.git
7951ee73 is described below

commit 7951ee733376ba2ecf00b7b7c727c4bd0a121a07
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Aug 30 21:14:13 2022 -0400

    Be a little more patient for slow builds
---
 .../pool2/impl/TestAbandonedKeyedObjectPool.java   | 23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/test/java/org/apache/commons/pool2/impl/TestAbandonedKeyedObjectPool.java b/src/test/java/org/apache/commons/pool2/impl/TestAbandonedKeyedObjectPool.java
index c99348dd..90ee0487 100644
--- a/src/test/java/org/apache/commons/pool2/impl/TestAbandonedKeyedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool2/impl/TestAbandonedKeyedObjectPool.java
@@ -196,29 +196,30 @@ public class TestAbandonedKeyedObjectPool {
     public void testAbandonedInvalidate() throws InterruptedException {
         abandonedConfig = new AbandonedConfig();
         abandonedConfig.setRemoveAbandonedOnMaintenance(true);
-        abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION);
+        abandonedConfig.setRemoveAbandonedTimeout(Duration.ofMillis(2000));
         pool.close();  // Unregister pool created by setup
         pool = new GenericKeyedObjectPool<>(
-                // destroys take 200 ms
-                new SimpleFactory(200, 0),
+                // destroys take 100 millis
+                new SimpleFactory(100, 0),
                 new GenericKeyedObjectPoolConfig<>(), abandonedConfig);
         final int n = 10;
         pool.setMaxTotal(n);
         pool.setBlockWhenExhausted(false);
-        pool.setTimeBetweenEvictionRuns(Duration.ofMillis(500));
-        PooledTestObject obj = null;
+        pool.setTimeBetweenEvictionRuns(Duration.ofMillis(250));
+        PooledTestObject pooledObj = null;
+        final Integer key = 0;
         for (int i = 0; i < 5; i++) {
-            obj = pool.borrowObject(0);
+            pooledObj = pool.borrowObject(key);
         }
-        Thread.sleep(1000);          // abandon checked out instances and let evictor start
-        if (!pool.getKeys().contains(0)) {
+        Thread.sleep(1000); // abandon checked out instances and let evictor start
+        if (!pool.getKeys().contains(key)) {
             Thread.sleep(1000); // Wait a little more.
         }
-        if (!pool.getKeys().contains(0)) {
+        if (!pool.getKeys().contains(key)) {
             Thread.sleep(1000); // Wait a little more.
         }
-        pool.invalidateObject(0, obj);  // Should not trigger another destroy / decrement
-        Thread.sleep(2000);          // give evictor time to finish destroys
+        pool.invalidateObject(key, pooledObj); // Should not trigger another destroy / decrement
+        Thread.sleep(2000); // give evictor time to finish destroys
         assertEquals(0, pool.getNumActive());
         assertEquals(5, pool.getDestroyedCount());
     }