zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "yangkun (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ZOOKEEPER-3135) ClientCnxnSocket#updateLastSendAndHeard() method update lastSend、lastHeard has some problem
Date Thu, 30 Aug 2018 02:59:00 GMT
yangkun created ZOOKEEPER-3135:
----------------------------------

             Summary: ClientCnxnSocket#updateLastSendAndHeard() method update lastSend、lastHeard
has some problem
                 Key: ZOOKEEPER-3135
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3135
             Project: ZooKeeper
          Issue Type: Bug
            Reporter: yangkun


ClientCnxnSocket#updateLastSendAndHeard() method update lastSend、lastHeard to now:

 
{code:java}
void updateLastSendAndHeard() {
    this.lastSend = now;
    this.lastHeard = now;
}

void updateNow() {
    now = Time.currentElapsedTime();
}{code}
In SendThread#run() method, there are some place call updateLastSendAndHeard() method, simplified
as follows:

 
{code:java}
public void run() {
    clientCnxnSocket.updateNow();
    // place-1. update lastSend、lastHeard
    clientCnxnSocket.updateLastSendAndHeard();
    while (state.isAlive()) {
        try {
        // ...some operation
        startConnect(serverAddress);
        // place-2. update lastSend、lastHeard
        clientCnxnSocket.updateLastSendAndHeard();
    }
}{code}
 

If so, place-1 and place-2, the lastSend、lastHeard value is equals, However, between place-1
and place-2 has some operation,consume some time,it should actually be unequal.

 

 

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message