dubbo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun liu <ken.lj...@gmail.com>
Subject Re: Why heartbeatTimeout is 3 times as much as heartbeat?
Date Tue, 13 Mar 2018 01:31:38 GMT
> hi, I'm a little puzzled, why heartbeatTimeout is 3 times as much as heartbeat?


Heart determines the interval to detect, while heartbeatTimeout determines when to announce
the connection is broken. 
3 times is the maximum heartbeat failures dubbo can bear before mark a connection as broken.

> On 10 Mar 2018, at 5:58 PM, 天 <1197596604@qq.com> wrote:
> 
> hi, I'm a little puzzled, why heartbeatTimeout is 3 times as much as heartbeat?
> 
> 
> public HeaderExchangeServer(Server server) {
>    if (server == null) {
>        throw new IllegalArgumentException("server == null");
>    }
>    this.server = server;
>    this.heartbeat = server.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0);
>    this.heartbeatTimeout = server.getUrl().getParameter(Constants.HEARTBEAT_TIMEOUT_KEY,
heartbeat * 3);
>    if (heartbeatTimeout < heartbeat * 2) {
>        throw new IllegalStateException("heartbeatTimeout < heartbeatInterval * 2");
>    }
>    startHeatbeatTimer();
> }


Mime
View raw message