You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/10/12 11:44:00 UTC

[jira] [Updated] (ZOOKEEPER-3821) improve getting snapCount and globalOutstandingLimit from System's Property

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-3821?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated ZOOKEEPER-3821:
--------------------------------------
    Labels: pull-request-available  (was: )

> improve getting snapCount and globalOutstandingLimit  from System's Property
> ----------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-3821
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3821
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>            Reporter: maoling
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> We have System.getProperty(SNAP_COUNT, defaultValue), we don't need to set the default value in an exception, that's not elegantĀ 
> {code:java}
> public static int getSnapCount() {
>     String sc = System.getProperty(SNAP_COUNT);
>     try {
>         int snapCount = Integer.parseInt(sc);        // snapCount must be 2 or more. See org.apache.zookeeper.server.SyncRequestProcessor
>         if (snapCount < 2) {
>             LOG.warn("SnapCount should be 2 or more. Now, snapCount is reset to 2");
>             snapCount = 2;
>         }
>         return snapCount;
>     } catch (Exception e) {
>         return 100000;
>     }
> }public int getGlobalOutstandingLimit() {
>     String sc = System.getProperty(GLOBAL_OUTSTANDING_LIMIT);
>     int limit;
>     try {
>         limit = Integer.parseInt(sc);
>     } catch (Exception e) {
>         limit = 1000;
>     }
>     return limit;
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)