szetszwo commented on code in PR #10079:
URL: https://github.com/apache/ozone/pull/10079#discussion_r3081342816


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java:
##########
@@ -179,6 +187,10 @@ public CompletableFuture<Message> applyTransaction(
   }
 
   private Message process(final SCMRatisRequest request) throws Exception {
+    final ScmInvoker<?> invoker = invokers.get(request.getType());
+    if (invoker != null) {
+      return process(request, invoker);

Review Comment:
   Let's change ScmInvoker.invokeLocal(..) to return message.  Then, we don't 
need to new `process` method:
   ```java
     private Message process(final SCMRatisRequest request) throws Exception {
       final ScmInvoker<?> invoker = invokers.get(request.getType());
       if (invoker != null) {
         return invoker.invokeLocal(request.getOperation(), 
request.getArguments());
       }
       return process(request, handlers.get(request.getType()));
     }
   ```



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java:
##########
@@ -117,6 +120,11 @@ public void registerHandler(RequestType type, Object 
handler) {
     handlers.put(type, handler);
   }
 
+  public void registerStateMachineInvoker(RequestType type,

Review Comment:
   Let's simply name it `registerInvoker`.
   
   BTW, this method is not called.  We need to update SCMRatisServerImpl:
   ```diff
   @@ -223,7 +224,11 @@ public SCMStateMachine getSCMStateMachine() {
      @Override
      public void registerStateMachineHandler(final RequestType handlerType,
                                              final Object handler) {
   -    stateMachine.registerHandler(handlerType, handler);
   +    if (handler instanceof ScmInvoker) {
   +      stateMachine.registerInvoker(handlerType, (ScmInvoker) handler);
   +    } else {
   +      stateMachine.registerHandler(handlerType, handler);
   +    }
      }
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to