You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by brianv0 <gi...@git.apache.org> on 2014/07/02 21:11:20 UTC

[GitHub] zookeeper pull request: Removed redundant code for processing PING...

GitHub user brianv0 opened a pull request:

    https://github.com/apache/zookeeper/pull/16

    Removed redundant code for processing PING request

    The code for processing the case of a PING request is redundant of the code following the switch statement. request.cxid = -2 in the case of a PING. 
    
    The difference between `break`ing and `return`ing is that the timing and effective execution order of the following calls is changed to:
    
    ```
    zks.getZKDatabase().getDataTreeLastProcessedZxid();
    zks.serverStats().updateLatency(request.createTime);
    cnxn.updateStatsForResponse(request.cxid, lastZxid, lastOp,
                        request.createTime, System.currentTimeMillis());
    ```
    
    From the current effective execution order:
    
    ```
    zks.serverStats().updateLatency(request.createTime);
    cnxn.updateStatsForResponse(request.cxid, request.zxid, lastOp,
                        request.createTime, System.currentTimeMillis());
    zks.getZKDatabase().getDataTreeLastProcessedZxid();
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/brianv0/zookeeper patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/zookeeper/pull/16.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #16
    
----
commit 96d75a48fb38cc2289a7062bc5c79441c40b941b
Author: Brian Van Klaveren <br...@users.noreply.github.com>
Date:   2014-07-02T19:10:09Z

    Removed redundant code for processing PING request
    
    The code for processing the case of a PING request is redundant of the code following the switch statement. request.cxid = -2 in the case of a PING. 
    
    The difference between `break`ing and `return`ing is that the timing and effective execution order of the following calls is changed to:
    
    ```
    zks.getZKDatabase().getDataTreeLastProcessedZxid();
    zks.serverStats().updateLatency(request.createTime);
    cnxn.updateStatsForResponse(request.cxid, lastZxid, lastOp,
                        request.createTime, System.currentTimeMillis());
    ```
    
    From the current effective execution order:
    
    ```
    zks.serverStats().updateLatency(request.createTime);
    cnxn.updateStatsForResponse(request.cxid, request.zxid, lastOp,
                        request.createTime, System.currentTimeMillis());
    zks.getZKDatabase().getDataTreeLastProcessedZxid();
    ```

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---