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

Ling Mao resolved ZOOKEEPER-3821.
---------------------------------
    Resolution: Fixed

> 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: Ling Mao
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 4h 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)

Reply via email to