Explorar el Código

ZOOKEEPER-4300: Simplify assignment statements of boolean

Author: lan <liaonan@souche.com>

Reviewers: maoling <maoling@apache.org>

Closes #1700 from lanicc/ZOOKEEPER-4300
lan hace 4 años
padre
commit
016ffd9a3e

+ 2 - 2
zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java

@@ -2112,7 +2112,7 @@ public class ZooKeeperServer implements SessionExpirer, ServerStats.Provider {
         //check the Count Quota
         if (checkCountQuota) {
             long newCount = currentStats.getCount() + countDiff;
-            boolean isCountHardLimit = limitStats.getCountHardLimit() > -1 ? true : false;
+            boolean isCountHardLimit = limitStats.getCountHardLimit() > -1;
             long countLimit = isCountHardLimit ? limitStats.getCountHardLimit() : limitStats.getCount();
 
             if (newCount > countLimit) {
@@ -2127,7 +2127,7 @@ public class ZooKeeperServer implements SessionExpirer, ServerStats.Provider {
         //check the Byte Quota
         if (checkByteQuota) {
             long newBytes = currentStats.getBytes() + bytesDiff;
-            boolean isByteHardLimit = limitStats.getByteHardLimit() > -1 ? true : false;
+            boolean isByteHardLimit = limitStats.getByteHardLimit() > -1;
             long byteLimit = isByteHardLimit ? limitStats.getByteHardLimit() : limitStats.getBytes();
             if (newBytes > byteLimit) {
                 String msg = "Quota exceeded: " + lastPrefix + " [current bytes=" + newBytes + ", " + (isByteHardLimit ? "hard" : "soft") + "ByteLimit=" + byteLimit + "]";