@lexburner @carryxyh 我看了下目前dubbo触发心跳检查的实现,每次检测完以后会往定时器重新放置任务

> timer.newTimeout(timeout.task(), tick, TimeUnit.MILLISECONDS);

而且每次启动心跳检检测的时候都会重新创建HashedWheelTimer

> heartbeatTimer = new HashedWheelTimer(new 
> NamedThreadFactory("dubbo-server-heartbeat", true), tickDuration,
                TimeUnit.MILLISECONDS, Constants.TICKS_PER_WHEEL);

是否可以整个应用共用一个HashedWheelTimer,给每个已经建立连接的socketChannel添加心跳检测任务,然后每次执行完心跳检查任务以后重新计算并设置触发下一次心跳检测的时间,再往定时器里面添加心跳检测任务,这样不仅避免了创建多个HashedWheelTimer,而且能更及时的检测到是否超时,并且也不用针对netty进行特例判断,不知道这种方式是不是更好一些?

[ Full content available at: 
https://github.com/apache/incubator-dubbo/issues/3151 ]
This message was relayed via gitbox.apache.org for 
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to