commit
2cf3164307
@ -21,7 +21,7 @@ import java.util.concurrent.*;
|
||||
* @author nacos
|
||||
*/
|
||||
public class GlobalExecutor {
|
||||
public static final long HEARTBEAT_INTVERAL_MS = TimeUnit.SECONDS.toMillis(5L);
|
||||
public static final long HEARTBEAT_INTERVAL_MS = TimeUnit.SECONDS.toMillis(5L);
|
||||
|
||||
public static final long LEADER_TIMEOUT_MS = TimeUnit.SECONDS.toMillis(15L);
|
||||
|
||||
@ -29,7 +29,7 @@ public class GlobalExecutor {
|
||||
|
||||
public static final long TICK_PERIOD_MS = TimeUnit.MILLISECONDS.toMillis(500L);
|
||||
|
||||
public static final long ADDRESS_SERVER_UPDATE_INTVERAL_MS = TimeUnit.SECONDS.toMillis(5L);
|
||||
public static final long ADDRESS_SERVER_UPDATE_INTERVAL_MS = TimeUnit.SECONDS.toMillis(5L);
|
||||
|
||||
private static ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(2, new ThreadFactory() {
|
||||
@Override
|
||||
|
@ -120,7 +120,7 @@ public class RaftCore {
|
||||
|
||||
GlobalExecutor.register(new MasterElection());
|
||||
GlobalExecutor.register1(new HeartBeat());
|
||||
GlobalExecutor.register(new AddressServerUpdater(), GlobalExecutor.ADDRESS_SERVER_UPDATE_INTVERAL_MS);
|
||||
GlobalExecutor.register(new AddressServerUpdater(), GlobalExecutor.ADDRESS_SERVER_UPDATE_INTERVAL_MS);
|
||||
|
||||
if (peers.size() > 0) {
|
||||
if (lock.tryLock(INIT_LOCK_TIME_SECONDS, TimeUnit.SECONDS)) {
|
||||
@ -132,7 +132,7 @@ public class RaftCore {
|
||||
}
|
||||
|
||||
Loggers.RAFT.info("timer started: leader timeout ms: " + GlobalExecutor.LEADER_TIMEOUT_MS
|
||||
+ "; heart-beat timeout ms: " + GlobalExecutor.HEARTBEAT_INTVERAL_MS);
|
||||
+ "; heart-beat timeout ms: " + GlobalExecutor.HEARTBEAT_INTERVAL_MS);
|
||||
}
|
||||
|
||||
public static List<RaftListener> getListeners() {
|
||||
|
@ -34,7 +34,7 @@ public class RaftPeer {
|
||||
|
||||
public volatile long leaderDueMs = RandomUtils.nextLong(0, GlobalExecutor.LEADER_TIMEOUT_MS);
|
||||
|
||||
public volatile long heartbeatDueMs = RandomUtils.nextLong(0, GlobalExecutor.HEARTBEAT_INTVERAL_MS);
|
||||
public volatile long heartbeatDueMs = RandomUtils.nextLong(0, GlobalExecutor.HEARTBEAT_INTERVAL_MS);
|
||||
|
||||
public State state = State.FOLLOWER;
|
||||
|
||||
@ -43,7 +43,7 @@ public class RaftPeer {
|
||||
}
|
||||
|
||||
public void resetHeartbeatDue() {
|
||||
heartbeatDueMs = GlobalExecutor.HEARTBEAT_INTVERAL_MS;
|
||||
heartbeatDueMs = GlobalExecutor.HEARTBEAT_INTERVAL_MS;
|
||||
}
|
||||
|
||||
public enum State {
|
||||
|
Loading…
Reference in New Issue
Block a user