You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2018/09/04 19:30:21 UTC
[bookkeeper] branch branch-4.8 updated: Fix
EntryLoggerAllocator.stop
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch branch-4.8
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/branch-4.8 by this push:
new 919e8e6 Fix EntryLoggerAllocator.stop
919e8e6 is described below
commit 919e8e69e93fca400c37250a8b0358eee40ff8bb
Author: cguttapalem <cg...@salesforce.com>
AuthorDate: Tue Sep 4 12:29:51 2018 -0700
Fix EntryLoggerAllocator.stop
Descriptions of the changes in this PR:
- make sure EntryLoggerAllocator.stop terminates pending allocatorExecutor's task.
Otherwise tests would flap, since even after EntryLoggerAllocator.stop, there is
possibility of new entrylog creation, which is not expected.
Author: cguttapalem <cg...@salesforce.com>
Reviewers: Andrey Yegorov <None>, Enrico Olivelli <eo...@gmail.com>, Sijie Guo <si...@apache.org>
This closes #1627 from reddycharan/entryalocshut
(cherry picked from commit af9d4c312ef1640fbbfb6765943c9a83242a4f37)
Signed-off-by: Sijie Guo <si...@apache.org>
---
.../org/apache/bookkeeper/bookie/EntryLoggerAllocator.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java
index 10e7715..3ddd8e2 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java
@@ -40,6 +40,8 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
import lombok.extern.slf4j.Slf4j;
import org.apache.bookkeeper.bookie.EntryLogger.BufferedLogChannel;
import org.apache.bookkeeper.conf.ServerConfiguration;
@@ -203,6 +205,16 @@ class EntryLoggerAllocator {
void stop() {
// wait until the preallocation finished.
allocatorExecutor.shutdown();
+ try {
+ if (!allocatorExecutor.awaitTermination(5, TimeUnit.SECONDS)) {
+ log.warn("Timedout while awaiting for allocatorExecutor's termination, so force shuttingdown");
+ }
+ } catch (InterruptedException e) {
+ log.warn("Got InterruptedException while awaiting termination of allocatorExecutor, so force shuttingdown");
+ Thread.currentThread().interrupt();
+ }
+ allocatorExecutor.shutdownNow();
+
log.info("Stopped entry logger preallocator.");
}