Browse Source

ZOOKEEPER-3811: cleaning up code,static field be directly referred by its class name

optimized code,A static field should be directly referred by its class name

Author: xavier <1217353758@qq.com>

Reviewers: Christopher Tubbs <ctubbsii@apache.org>, Fangmin Lyu <fangmin@apache.org>, Mate Szalay-Beko <symat@apache.org>

Closes #1337 from XavierChengZW/master
xavier 5 years ago
parent
commit
2e14a29cc6

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

@@ -100,8 +100,8 @@ public class RequestThrottler extends ZooKeeperCriticalThread {
 
     protected boolean shouldThrottleOp(Request request, long elapsedTime) {
         return request.isThrottlable()
-                && zks.getThrottledOpWaitTime() > 0
-                && elapsedTime > zks.getThrottledOpWaitTime();
+                && ZooKeeperServer.getThrottledOpWaitTime() > 0
+                && elapsedTime > ZooKeeperServer.getThrottledOpWaitTime();
     }
 
 

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

@@ -316,11 +316,11 @@ public class ZooKeeperServerBean implements ZooKeeperServerMXBean, ZKMBeanInfo {
     ///////////////////////////////////////////////////////////////////////////
 
     public int getThrottledOpWaitTime() {
-        return zks.getThrottledOpWaitTime();
+        return ZooKeeperServer.getThrottledOpWaitTime();
     }
 
     public void setThrottledOpWaitTime(int val) {
-        zks.setThrottledOpWaitTime(val);
+        ZooKeeperServer.setThrottledOpWaitTime(val);
     }
 
     ///////////////////////////////////////////////////////////////////////////