Madan Jampani
Committed by Gerrit Code Review

Lower netty reply timeout to 250ms

Change-Id: Id125a2b37458a0c31c7fbf5ba03a9d4b38283c48
...@@ -94,7 +94,7 @@ import static org.onosproject.security.AppPermission.Type.CLUSTER_WRITE; ...@@ -94,7 +94,7 @@ import static org.onosproject.security.AppPermission.Type.CLUSTER_WRITE;
94 @Service 94 @Service
95 public class NettyMessagingManager implements MessagingService { 95 public class NettyMessagingManager implements MessagingService {
96 96
97 - private static final int REPLY_TIME_OUT_SEC = 2; 97 + private static final int REPLY_TIME_OUT_MILLIS = 250;
98 private static final short MIN_KS_LENGTH = 6; 98 private static final short MIN_KS_LENGTH = 6;
99 99
100 private final Logger log = LoggerFactory.getLogger(getClass()); 100 private final Logger log = LoggerFactory.getLogger(getClass());
...@@ -110,7 +110,7 @@ public class NettyMessagingManager implements MessagingService { ...@@ -110,7 +110,7 @@ public class NettyMessagingManager implements MessagingService {
110 private final Map<String, Consumer<InternalMessage>> handlers = new ConcurrentHashMap<>(); 110 private final Map<String, Consumer<InternalMessage>> handlers = new ConcurrentHashMap<>();
111 private final AtomicLong messageIdGenerator = new AtomicLong(0); 111 private final AtomicLong messageIdGenerator = new AtomicLong(0);
112 private final Cache<Long, Callback> callbacks = CacheBuilder.newBuilder() 112 private final Cache<Long, Callback> callbacks = CacheBuilder.newBuilder()
113 - .expireAfterWrite(REPLY_TIME_OUT_SEC, TimeUnit.SECONDS) 113 + .expireAfterWrite(REPLY_TIME_OUT_MILLIS, TimeUnit.MILLISECONDS)
114 .removalListener(new RemovalListener<Long, Callback>() { 114 .removalListener(new RemovalListener<Long, Callback>() {
115 @Override 115 @Override
116 public void onRemoval(RemovalNotification<Long, Callback> entry) { 116 public void onRemoval(RemovalNotification<Long, Callback> entry) {
...@@ -159,7 +159,7 @@ public class NettyMessagingManager implements MessagingService { ...@@ -159,7 +159,7 @@ public class NettyMessagingManager implements MessagingService {
159 initEventLoopGroup(); 159 initEventLoopGroup();
160 startAcceptingConnections(); 160 startAcceptingConnections();
161 started.set(true); 161 started.set(true);
162 - serverGroup.scheduleWithFixedDelay(callbacks::cleanUp, 0, REPLY_TIME_OUT_SEC, TimeUnit.SECONDS); 162 + serverGroup.scheduleWithFixedDelay(callbacks::cleanUp, 0, REPLY_TIME_OUT_MILLIS, TimeUnit.MILLISECONDS);
163 log.info("Started"); 163 log.info("Started");
164 } 164 }
165 165
......