ChenSammi commented on code in PR #561:
URL: https://github.com/apache/ratis/pull/561#discussion_r911664485


##########
ratis-common/src/main/java/org/apache/ratis/util/LifeCycle.java:
##########
@@ -100,8 +100,8 @@ static void put(State key, Map<State, List<State>> map, 
State... values) {
       put(PAUSING,   predecessors, RUNNING);
       put(PAUSED,    predecessors, PAUSING);
       put(EXCEPTION, predecessors, STARTING, PAUSING, RUNNING);
-      put(CLOSING,   predecessors, STARTING, RUNNING, PAUSING, PAUSED, 
EXCEPTION);
-      put(CLOSED,    predecessors, NEW, CLOSING);
+      put(CLOSING,   predecessors, NEW, STARTING, RUNNING, PAUSING, PAUSED, 
EXCEPTION);
+      put(CLOSED,    predecessors, CLOSING);

Review Comment:
   Another one is NettyRpcService. It starts the netty server in constructor 
not in the startImpl call.  So for the RaftServer using nettyRpcService, even 
this RaftServer is in NEW state, we should call it's closeImpl.  But currently 
it's not called on NEW state.  I didn't find a better solution for this one. So 
I basically suggest change the checkStateAndClose implemention as following. 
What do you think? 
   
   ```
   if (compareAndTransition(State.NEW, State.CLOSED)) {
         return closeMethod.get();
    }
   ```



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