You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sh...@apache.org on 2020/04/27 10:06:13 UTC

[incubator-ratis] branch master updated: RATIS-849. Fix Failed UT: GroupManagementBaseTest.runMultiGroupTest (#67)

This is an automated email from the ASF dual-hosted git repository.

shashikant pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ratis.git


The following commit(s) were added to refs/heads/master by this push:
     new e9683cf  RATIS-849. Fix Failed UT: GroupManagementBaseTest.runMultiGroupTest (#67)
e9683cf is described below

commit e9683cf43573d31c6ea768e0b750f5e455098ef6
Author: runzhiwang <51...@users.noreply.github.com>
AuthorDate: Mon Apr 27 18:06:06 2020 +0800

    RATIS-849. Fix Failed UT: GroupManagementBaseTest.runMultiGroupTest (#67)
---
 .../java/org/apache/ratis/netty/server/NettyRpcService.java    | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java b/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java
index 3d3c829..07a6b71 100644
--- a/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java
+++ b/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java
@@ -45,15 +45,19 @@ import org.apache.ratis.proto.netty.NettyProtos.RaftNettyServerReplyProto;
 import org.apache.ratis.proto.netty.NettyProtos.RaftNettyServerRequestProto;
 import org.apache.ratis.util.CodeInjectionForTesting;
 import org.apache.ratis.util.ProtoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
+import java.util.concurrent.TimeUnit;
 import java.util.Objects;
 
 /**
  * A netty server endpoint that acts as the communication layer.
  */
 public final class NettyRpcService extends RaftServerRpcWithProxy<NettyRpcProxy, NettyRpcProxy.PeerMap> {
+  public static final Logger LOG = LoggerFactory.getLogger(NettyRpcService.class);
   static final String CLASS_NAME = NettyRpcService.class.getSimpleName();
   public static final String SEND_SERVER_REQUEST = CLASS_NAME + ".sendServerRequest";
 
@@ -141,6 +145,12 @@ public final class NettyRpcService extends RaftServerRpcWithProxy<NettyRpcProxy,
   public void closeImpl() throws IOException {
     bossGroup.shutdownGracefully();
     workerGroup.shutdownGracefully();
+    try {
+      bossGroup.awaitTermination(1000, TimeUnit.MILLISECONDS);
+      workerGroup.awaitTermination(1000, TimeUnit.MILLISECONDS);
+    } catch (InterruptedException e) {
+      LOG.error("Interrupt EventLoopGroup terminate", e);
+    }
     final ChannelFuture f = getChannel().close();
     super.closeImpl();
     f.syncUninterruptibly();