Netty: Close idle tcp connections between controller instances
Change-Id: Ieb6fddce85f015c64e5f0276f0d361a3a93b8fb4
diff --git a/utils/netty/src/main/java/org/onlab/netty/NettyMessaging.java b/utils/netty/src/main/java/org/onlab/netty/NettyMessaging.java
index 9c63d84..09bcdf7 100644
--- a/utils/netty/src/main/java/org/onlab/netty/NettyMessaging.java
+++ b/utils/netty/src/main/java/org/onlab/netty/NettyMessaging.java
@@ -117,9 +117,11 @@
return;
}
this.localEp = localEp;
- channels.setLifo(false);
+ channels.setLifo(true);
channels.setTestOnBorrow(true);
channels.setTestOnReturn(true);
+ channels.setMinEvictableIdleTimeMillis(60_000L);
+ channels.setTimeBetweenEvictionRunsMillis(30_000L);
initEventLoopGroup();
startAcceptingConnections();
started.set(true);
@@ -265,6 +267,7 @@
@Override
public void destroyObject(Endpoint ep, Channel channel) throws Exception {
+ log.info("Closing connection to {}", ep);
channel.close();
}