lvfangmin commented on a change in pull request #1056: ZOOKEEPER-3495: fix 
SnapshotDigestTest to work with JDK12+
URL: https://github.com/apache/zookeeper/pull/1056#discussion_r319232082
 
 

 ##########
 File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/DigestCalculator.java
 ##########
 @@ -16,37 +16,39 @@
  * limitations under the License.
  */
 
-package org.apache.zookeeper.server.util;
+package org.apache.zookeeper.server;
 
 import java.nio.ByteBuffer;
 import java.util.zip.CRC32;
 import org.apache.zookeeper.ZooDefs;
 import org.apache.zookeeper.data.StatPersisted;
-import org.apache.zookeeper.server.DataNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * Defines how to calculate the digest for a given node.
  */
-public class DigestCalculator {
+class DigestCalculator {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(DigestCalculator.class);
 
     // The hardcoded digest version, should bump up this version whenever
     // we changed the digest method or fields.
-    //
-    // Defined it as Integer to make it able to be changed in test via 
reflection
-    public static final Integer DIGEST_VERSION = 2;
+    private static final int DIGEST_VERSION = 2;
 
     public static final String ZOOKEEPER_DIGEST_ENABLED = 
"zookeeper.digest.enabled";
-    private static boolean digestEnabled;
 
     static {
-        digestEnabled = 
Boolean.parseBoolean(System.getProperty(ZOOKEEPER_DIGEST_ENABLED, "true"));
-        LOG.info("{} = {}", ZOOKEEPER_DIGEST_ENABLED, digestEnabled);
+        LOG.info("{} = {}", ZOOKEEPER_DIGEST_ENABLED, 
System.getProperty(ZOOKEEPER_DIGEST_ENABLED, "true"));
     }
 
+    private boolean digestEnabled;
+
+    DigestCalculator() {
+        this.digestEnabled = 
Boolean.parseBoolean(System.getProperty(ZOOKEEPER_DIGEST_ENABLED, "true"));
 
 Review comment:
   Probably we should move this setting to ZooKeeperServer, so that it can be 
shared and used in static classes like SerializeUtil.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to