[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16018288#comment-16018288
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2784:
-------------------------------------------

Github user eribeiro commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/257#discussion_r117600729
  
    --- Diff: 
src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java ---
    @@ -310,8 +311,8 @@ public boolean initiateConnection(Socket sock, Long 
sid) {
          * possible long value to lose the challenge.
          *
          */
    -    public void receiveConnection(Socket sock) {
    -        Long sid = null, protocolVersion = null;
    +    public void receiveConnection(Socket sock) throws ConfigException {
    +        Long sid, protocolVersion;
    --- End diff --
    
    Yes, integers whose values are between -127 and 128 (inclusive) are cached 
inside Integer object.
    
    Plus, boxing/unboxing in a tight loop (not the case here!) can be a huge 
performance pitfall. For example:
    
    ```
    for (Integer it = 0; it < 10000; ){
           it += 1;
    }
    ```
    Used to have abysmal performance numbers due to many auto boxing/unboxing .


> Add some limitations on code level for `SID` to avoid configuration problem
> ---------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2784
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2784
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: quorum
>    Affects Versions: 3.5.2
>            Reporter: Benedict Jin
>             Fix For: 3.6.0
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> As so far, `QuorumCnxManager#receiveConnection` cannot find out the same 
> `SID` problem, then the Zookeeper cluster will start successfully. But the 
> cluster is not health, and it will throw some problem like `not 
> synchronized`. So, i thought we should add some limitations on code level for 
> `SID` to find those configuration problem more early.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to