This is an automated email from the ASF dual-hosted git repository.
zhaijia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 450629d ISSUE #221: Make netty server shutdown idempotent
450629d is described below
commit 450629d4314cf467fbf78da2d2a43840d0ccf783
Author: Sijie Guo <[email protected]>
AuthorDate: Sat Jul 1 15:05:43 2017 +0800
ISSUE #221: Make netty server shutdown idempotent
Descriptions of the changes in this PR:
(see the detailed discussion in #221 )
Author: Sijie Guo <[email protected]>
Reviewers: Enrico Olivelli <None>, Jia Zhai <None>
This closes #222 from sijie/make_shutdown_idempotent, closes #221
---
.../main/java/org/apache/bookkeeper/proto/BookieNettyServer.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
index 53fd334..22c3cff 100644
---
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
+++
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
@@ -85,6 +85,7 @@ class BookieNettyServer {
final EventLoopGroup jvmEventLoopGroup;
final RequestProcessor requestProcessor;
final AtomicBoolean isRunning = new AtomicBoolean(false);
+ final AtomicBoolean isClosed = new AtomicBoolean(false);
final Object suspensionLock = new Object();
volatile boolean suspended = false;
ChannelGroup allChannels;
@@ -279,6 +280,12 @@ class BookieNettyServer {
void shutdown() {
LOG.info("Shutting down BookieNettyServer");
isRunning.set(false);
+
+ if (!isClosed.compareAndSet(false, true)) {
+ // the netty server is already closed.
+ return;
+ }
+
allChannels.close().awaitUninterruptibly();
if (eventLoopGroup != null) {
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].