amaliujia commented on code in PR #1647:
URL: https://github.com/apache/ratis/pull/1647#discussion_r4333380385
##########
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, TaskStatus.COMPLETED).
+ *
+ * @deprecated please use/override {@link
#notifyServerShutdown(RoleInfoProto, boolean, TaskStatus)} instead
*/
@Deprecated
default void notifyServerShutdown(RoleInfoProto roleInfo) {
- notifyServerShutdown(roleInfo, false);
+ notifyServerShutdown(roleInfo, false, TaskStatus.COMPLETED);
+ }
+
+ /**
+ * The same as notifyServerShutdown(roleInfo, allServer,
TaskStatus.COMPLETED).
+ *
+ * @deprecated please use/override {@link
#notifyServerShutdown(RoleInfoProto, boolean, TaskStatus)} instead
+ */
+ @Deprecated
+ default void notifyServerShutdown(RoleInfoProto roleInfo, boolean
allServer) {
+ notifyServerShutdown(roleInfo, allServer, TaskStatus.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 TaskStatus#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 TaskStatus#INITIATED}.
+ * <p>
+ * {@link TaskStatus#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 taskStatus {@link TaskStatus#INITIATED} or {@link
TaskStatus#COMPLETED}
*/
- default void notifyServerShutdown(RoleInfoProto roleInfo, boolean
allServer) {}
+ default void notifyServerShutdown(RoleInfoProto roleInfo, boolean
allServer, TaskStatus taskStatus) {}
Review Comment:
done. Also changed for existing API. As far as I know, change parameter name
does not break compatibility in Java.
--
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]