DatabaseManager: extended election Timeout 2s -> 5s

Change-Id: I192113f634cd27c21b7d987b784bc81b1c6bde44
This commit is contained in:
Yuta HIGUCHI 2014-11-25 12:13:30 -08:00
parent e5ab13826c
commit d88400b288

View File

@ -117,9 +117,12 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService {
private volatile LeaderElectEvent myLeaderEvent = null;
// TODO make this configuratble
// TODO make this configurable
private int maxLogSizeBytes = 128 * (1024 ^ 2);
// TODO make this configurable
private long electionTimeoutMs = 5000; // CopyCat default: 2000
@Activate
public void activate() throws InterruptedException, ExecutionException {
@ -181,6 +184,7 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService {
CopycatConfig ccConfig = new CopycatConfig();
ccConfig.setMaxLogSize(maxLogSizeBytes);
ccConfig.setElectionTimeout(electionTimeoutMs);
copycat = new Copycat(stateMachine, consensusLog, cluster, copycatMessagingProtocol, ccConfig);
copycat.event(LeaderElectEvent.class).registerHandler(new RaftLeaderElectionMonitor());