amaliujia commented on code in PR #1647:
URL: https://github.com/apache/ratis/pull/1647#discussion_r4367406105


##########
ratis-server-api/src/main/java/org/apache/ratis/statemachine/StateMachine.java:
##########
@@ -229,20 +234,39 @@ default void notifyLogFailed(Throwable cause, 
LogEntryProto failedEntry) {}
     default void notifySnapshotInstalled(InstallSnapshotResult result, long 
snapshotIndex,  RaftPeer peer) {}
 
     /**
-     * Notify the {@link StateMachine} that the server for this division has 
been shut down.
-     * @deprecated please use/override {@link 
#notifyServerShutdown(RoleInfoProto, boolean)} instead
+     * The same as notifyServerShutdown(roleInfo, false, 
EventStatus.COMPLETED).
+     *
+     * @deprecated please use/override {@link 
#notifyServerShutdown(RoleInfoProto, boolean, EventStatus)} instead
      */
     @Deprecated
     default void notifyServerShutdown(RoleInfoProto roleInfo) {
-      notifyServerShutdown(roleInfo, false);
+      notifyServerShutdown(roleInfo, false, EventStatus.COMPLETED);
+    }
+
+    /**
+     * The same as notifyServerShutdown(roleInfo, allServers, 
EventStatus.COMPLETED).
+     *
+     * @deprecated please use/override {@link 
#notifyServerShutdown(RoleInfoProto, boolean, EventStatus)} instead
+     */
+    @Deprecated
+    default void notifyServerShutdown(RoleInfoProto roleInfo, boolean 
allServers) {
+      notifyServerShutdown(roleInfo, allServers, EventStatus.COMPLETED);
     }
 
     /**
-     * Notify the {@link StateMachine} that either the server for this 
division or all the servers have been shut down.
+     * Notify the {@link StateMachine} server shutdown.
+     * <p>
+     * {@link EventStatus#INITIATED} is notified before the shutdown has 
closed any resources,
+     * in particular, before waiting for the committed log entries to be 
applied to this {@link StateMachine},
+     * which is unbounded in time.  An implementation must return promptly for 
{@link EventStatus#INITIATED}.
+     * <p>
+     * {@link EventStatus#COMPLETED} is notified after the shutdown has 
completed.
+     *
      * @param roleInfo roleInfo this server
-     * @param allServer whether all raft servers will be shutdown at this time
+     * @param allServers whether all raft servers will be shutdown at this time
+     * @param eventStatus {@link EventStatus#INITIATED} or {@link 
EventStatus#COMPLETED}
      */
-    default void notifyServerShutdown(RoleInfoProto roleInfo, boolean 
allServer) {}
+    default void notifyServerShutdown(RoleInfoProto roleInfo, boolean 
allServers, EventStatus eventStatus) {}

Review Comment:
   Ah actually I guess the complete solution is this:
   
   ```
   /**
    * Notify the {@link StateMachine} that either the server for this division 
or all the servers have been shut down.
    *
    * @deprecated please use/override {@link 
#notifyServerShutdown(RoleInfoProto, boolean, EventStatus)} instead
    */
   @Deprecated
   default void notifyServerShutdown(RoleInfoProto roleInfo, boolean 
allServers) {}
   
   
   /** ... existing Javadoc ... */
   default void notifyServerShutdown(RoleInfoProto roleInfo, boolean 
allServers, EventStatus eventStatus) {
     // preserve the existing behavior
     if (eventStatus == EventStatus.COMPLETED) {
       notifyServerShutdown(roleInfo, allServers);
     }
   }
   ```
   
   It became a bit confusing to me...



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

Reply via email to