From a85bc98927f368cf3dab8c0fcddf9f5a8c8a6cdf Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Sat, 12 Oct 2024 16:02:06 +0800 Subject: [PATCH] test --- .../tests/election/NetworkPartitionChannelTest.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/junit-functional/org/jgroups/tests/election/NetworkPartitionChannelTest.java b/tests/junit-functional/org/jgroups/tests/election/NetworkPartitionChannelTest.java index b9aea3b..0b0b1fc 100644 --- a/tests/junit-functional/org/jgroups/tests/election/NetworkPartitionChannelTest.java +++ b/tests/junit-functional/org/jgroups/tests/election/NetworkPartitionChannelTest.java @@ -171,10 +171,10 @@ private int index(Address addr) { } private void park(int ms) { - long deadline = System.nanoTime() + ms * 1000_000L; + long deadline = System.currentTimeMillis() + ms; do { LockSupport.parkUntil(deadline); - } while (System.nanoTime() < deadline); + } while (System.currentTimeMillis() < deadline); } void waitUntilPreVoteThreadStops(long timeout, int... indexes) { @@ -182,9 +182,7 @@ void waitUntilPreVoteThreadStops(long timeout, int... indexes) { .filter(t -> t instanceof ELECTION2).toArray(ELECTION2[]::new); if (a.length == 0) return; eventually(() -> { - for (ELECTION2 e : a) { - if (e.isPreVoteThreadRunning()) return false; - } + for (ELECTION2 e : a) if (e.isPreVoteThreadRunning()) return false; return true; }, timeout, TimeUnit.MILLISECONDS); }