From 6c15124d6f24a83237aa4654148e6e51d657ccba Mon Sep 17 00:00:00 2001 From: Tsz-Wo Nicholas Sze Date: Mon, 7 Oct 2024 09:12:29 -0700 Subject: [PATCH] Revert pom.xml changes. --- pom.xml | 8 ++++---- .../java/org/apache/ratis/util/DataBlockingQueue.java | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 21483043f2..94f3a7d99f 100644 --- a/pom.xml +++ b/pom.xml @@ -176,7 +176,7 @@ 3.3.0 4.0.6 1.6.1 - 3.5.1 + 3.0.0-M4 3.5.3 3.4.0 @@ -223,8 +223,8 @@ 4 2.0.7 - 5.11.2 - 0.8.12 + 5.10.1 + 0.8.11 @@ -427,7 +427,7 @@ org.junit junit-bom - ${junit-bom.version} + ${junit.jupiter.version} pom import diff --git a/ratis-common/src/main/java/org/apache/ratis/util/DataBlockingQueue.java b/ratis-common/src/main/java/org/apache/ratis/util/DataBlockingQueue.java index 4651bcf230..fb0f0715c5 100644 --- a/ratis-common/src/main/java/org/apache/ratis/util/DataBlockingQueue.java +++ b/ratis-common/src/main/java/org/apache/ratis/util/DataBlockingQueue.java @@ -75,6 +75,7 @@ public void clear() { } } + /** Apply the given handler to each element and then {@link #clear()}. */ public void clear(Consumer handler) { try(AutoCloseableLock auto = AutoCloseableLock.acquire(lock)) { for(E e : this) { @@ -84,8 +85,13 @@ public void clear(Consumer handler) { } } + /** + * Close this queue to stop accepting new elements, i.e. the offer(…) methods always return false. + * Note that closing the queue will not clear the existing elements. + * The existing elements can be peeked, polled or cleared after close. + */ public void close() { - try(AutoCloseableLock auto = AutoCloseableLock.acquire(lock)) { + try(AutoCloseableLock ignored = AutoCloseableLock.acquire(lock)) { closed = true; } }