narendly commented on a change in pull request #671: Add ZooKeeperAccessor to 
helix-rest
URL: https://github.com/apache/helix/pull/671#discussion_r367058485
 
 

 ##########
 File path: 
helix-rest/src/main/java/org/apache/helix/rest/server/ServerContext.java
 ##########
 @@ -122,27 +122,34 @@ public HelixDataAccessor getDataAccssor(String 
clusterName) {
     }
   }
 
-  public ZkBaseDataAccessor<byte[]> getByteArrayBaseDataAccessor() {
-    if (_byteArrayBaseDataAccessor == null) {
-      synchronized (this) {
-        if (_byteArrayBaseDataAccessor == null) {
-          _byteArrayBaseDataAccessor = new ZkBaseDataAccessor<>(_zkAddr, new 
ZkSerializer() {
-            @Override
-            public byte[] serialize(Object o)
-                throws ZkMarshallingError {
-              throw new UnsupportedOperationException("Serialize is not 
supported yet!");
-            }
-
-            @Override
-            public Object deserialize(byte[] bytes)
-                throws ZkMarshallingError {
-              return bytes;
-            }
-          });
-        }
+  /**
+   * Returns a lazily-instantiated ZkBaseDataAccessor for the byte array type.
+   * @return
+   */
+  public ZkBaseDataAccessor<byte[]> getByteArrayZkBaseDataAccessor() {
+    ZkBaseDataAccessor<byte[]> byteArrayZkBaseDataAccessor = 
_byteArrayZkBaseDataAccessor;
+    if (byteArrayZkBaseDataAccessor != null) { // First check (no locking)
+      return byteArrayZkBaseDataAccessor;
+    }
+
+    synchronized (this) {
+      if (_byteArrayZkBaseDataAccessor == null) { // Second check (with 
locking)
+        _byteArrayZkBaseDataAccessor = new ZkBaseDataAccessor<>(_zkAddr, new 
ZkSerializer() {
+          @Override
+          public byte[] serialize(Object o)
+              throws ZkMarshallingError {
+            throw new UnsupportedOperationException("serialize() is not 
supported yet!");
 
 Review comment:
   This will be supported at some point. I will change the log message, but add 
a TODO here.

----------------------------------------------------------------
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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@helix.apache.org
For additional commands, e-mail: reviews-h...@helix.apache.org

Reply via email to