From 5a589974443b1dd99f2d6755d15ce3353febb3eb Mon Sep 17 00:00:00 2001 From: "Kenneth J. Shackleton" Date: Tue, 25 Jun 2024 08:13:17 +0100 Subject: [PATCH] Replace scheduleAtFixedRate when evicting with scheduleWithFixedDelay for single object pool. Signed-off-by: Kenneth J. Shackleton --- .../main/kotlin/com/bloomberg/selekt/pools/SingleObjectPool.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selekt-java/src/main/kotlin/com/bloomberg/selekt/pools/SingleObjectPool.kt b/selekt-java/src/main/kotlin/com/bloomberg/selekt/pools/SingleObjectPool.kt index eed41aaeaa..a2c278ab67 100644 --- a/selekt-java/src/main/kotlin/com/bloomberg/selekt/pools/SingleObjectPool.kt +++ b/selekt-java/src/main/kotlin/com/bloomberg/selekt/pools/SingleObjectPool.kt @@ -97,6 +97,7 @@ class SingleObjectPool>( } }?.let { factory.destroyObject(it) + attemptScheduleEviction() } @GuardedBy("mutex") @@ -118,7 +119,7 @@ class SingleObjectPool>( if (evictionIntervalMillis < 0L || isClosed) { return } - future = executor.scheduleAtFixedRate( + future = executor.scheduleWithFixedDelay( ::evict, evictionDelayMillis, evictionIntervalMillis,