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/07/30 16:51:36 UTC
[commons-pool] branch master updated: Reuse ThreadUtils
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 afb68059 Reuse ThreadUtils
afb68059 is described below
commit afb68059968d23726f42b6ea80f24e5c1aa298d4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jul 30 12:51:32 2023 -0400
Reuse ThreadUtils
---
src/test/java/org/apache/commons/pool3/Waiter.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/test/java/org/apache/commons/pool3/Waiter.java b/src/test/java/org/apache/commons/pool3/Waiter.java
index 7939546a..30279dcb 100644
--- a/src/test/java/org/apache/commons/pool3/Waiter.java
+++ b/src/test/java/org/apache/commons/pool3/Waiter.java
@@ -17,8 +17,11 @@
package org.apache.commons.pool3;
+import java.time.Duration;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.commons.lang3.ThreadUtils;
+
/**
* <p>Object created by {@link WaiterFactory}. Maintains active / valid state,
* last passivated and idle times. Waits with configurable latency when
@@ -28,14 +31,11 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public class Waiter {
private static final AtomicInteger instanceCount = new AtomicInteger();
- /** TODO Reuse Apache Commons Lang ThreadUtils */
+
public static void sleepQuietly(final long millis) {
- try {
- Thread.sleep(millis);
- } catch (final InterruptedException e) {
- // be quiet
- }
+ ThreadUtils.sleepQuietly(Duration.ofMillis(millis));
}
+
private boolean active;
private boolean valid;
private long latency;