szetszwo commented on code in PR #1166:
URL: https://github.com/apache/ratis/pull/1166#discussion_r1795727341


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java:
##########
@@ -250,6 +250,8 @@ public long[] getFollowerNextIndices() {
   private final AtomicBoolean firstElectionSinceStartup = new 
AtomicBoolean(true);
   private final ThreadGroup threadGroup;
 
+  private Runnable testOnlyInject = () -> {};
+

Review Comment:
   We already have a `CodeInjectionForTesting` mechanism.  Please use it 
instead.
   ```diff
   +++ 
b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
   @@ -161,6 +161,7 @@ class RaftServerImpl implements RaftServer.Division,
      static final String APPEND_TRANSACTION = CLASS_NAME + 
".appendTransaction";
      static final String LOG_SYNC = APPEND_ENTRIES + ".logComplete";
      static final String START_LEADER_ELECTION = CLASS_NAME + 
".startLeaderElection";
   +  static final String START_COMPLETE = CLASS_NAME + ".startComplete";
    
      class Info implements DivisionInfo {
        @Override
   @@ -401,6 +402,7 @@ class RaftServerImpl implements RaftServer.Division,
    
        jmxAdapter.registerMBean();
        state.start();
   +    CodeInjectionForTesting.execute(START_COMPLETE, getId(), null, role);
        startComplete.compareAndSet(false, true);
        return true;
      }
   ```



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