anmolnar commented on code in PR #1961:
URL: https://github.com/apache/zookeeper/pull/1961#discussion_r1072282790


##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java:
##########
@@ -1151,6 +1213,9 @@ protected void setLocalSessionFlag(Request si) {
     }
 
     public void submitRequest(Request si) {
+        if (state == State.MAINTENANCE) {
+            throw new IllegalStateException("Zookeeper server is in 
maintenance state");
+        }

Review Comment:
   +1 for the logging suggestion of @eolivelli .
   I also like the Latch approach @li4wang . I think you have to use 
`AtomicReference<CountDownLatch>` for that, because you create a new instance 
every time ZK enters into Maintenance mode. In `submitRequest()` you'll try 
grabbing the reference by `get()` and if it's not null, await for it.



##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java:
##########
@@ -1151,6 +1213,9 @@ protected void setLocalSessionFlag(Request si) {
     }
 
     public void submitRequest(Request si) {
+        if (state == State.MAINTENANCE) {
+            throw new IllegalStateException("Zookeeper server is in 
maintenance state");
+        }

Review Comment:
   +1 for the logging suggestion of @eolivelli .
   
   I also like the Latch approach @li4wang . I think you have to use 
`AtomicReference<CountDownLatch>` for that, because you create a new instance 
every time ZK enters into Maintenance mode. In `submitRequest()` you'll try 
grabbing the reference by `get()` and if it's not null, await for it.



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

To unsubscribe, e-mail: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to