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_r335913856
##########
File path:
zookeeper-server/src/main/java/org/apache/zookeeper/server/ServerCnxnFactory.java
##########
@@ -272,4 +277,48 @@ protected void configureSaslLogin() throws IOException {
}
}
+ /** Maximum number of connections allowed in the ZooKeeper system */
+ public int getMaxCnxns() {
+ return maxCnxns;
+ }
+
+ protected void initMaxCnxns() {
+ String mxCxnProp = System.getProperty(ZOOKEEPER_MAX_CONNECTION);
+ maxCnxns = ZOOKEEPER_MAX_CONNECTION_DEFAULT;
+ if (null != mxCxnProp) {
+ LOG.info("maxCnxns configured value is {}.", mxCxnProp);
+ try {
+ maxCnxns = Integer.parseInt(mxCxnProp.trim());
+ } catch (NumberFormatException e) {
+ LOG.warn("maxCnxns configured value '{}' can not be parsed to
integer, using default value {}.",
+ mxCxnProp, ZOOKEEPER_MAX_CONNECTION_DEFAULT);
+ }
Review comment:
Done, thanks
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services