sujithsimon22 commented on a change in pull request #1108: ZOOKEEPER-2238: 
Support limiting the maximum number of connections/clients to a zookeeper server
URL: https://github.com/apache/zookeeper/pull/1108#discussion_r343484837
 
 

 ##########
 File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxnFactory.java
 ##########
 @@ -273,6 +273,10 @@ private boolean doAccept() {
             try {
                 sc = acceptSocket.accept();
                 accepted = true;
+                if (limitTotalNumberOfCnxns()) {
+                    accepted = false;
+                    return accepted;
+                }
 
 Review comment:
   Thanks @eribeiro for the review :) I have modified the implementation as 
requested.
   I agree with your point and I guess it makes more sense to throw an 
exception, catch it and close the channel, after incrementing the metrics. I 
have also moved the metrics count out of `limitTotalNumberOfCnxns` and added it 
seperately for `NettyServerCnxnFactory`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to