|
@@ -68,7 +68,34 @@ public class FastLeaderElection implements Election {
|
|
|
* the system up again after long partitions. Currently 60 seconds.
|
|
|
*/
|
|
|
|
|
|
- final static int maxNotificationInterval = 60000;
|
|
|
+ private static int maxNotificationInterval = 60000;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Lower bound for notification check. The observer don't need to use
|
|
|
+ * the same lower bound as participant members
|
|
|
+ */
|
|
|
+ private static int minNotificationInterval = finalizeWait;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Minimum notification interval, default is equal to finalizeWait
|
|
|
+ */
|
|
|
+ public static final String MIN_NOTIFICATION_INTERVAL =
|
|
|
+ "zookeeper.fastleader.minNotificationInterval";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Maximum notification interval, default is 60s
|
|
|
+ */
|
|
|
+ public static final String MAX_NOTIFICATION_INTERVAL =
|
|
|
+ "zookeeper.fastleader.maxNotificationInterval";
|
|
|
+
|
|
|
+ static {
|
|
|
+ minNotificationInterval = Integer.getInteger(MIN_NOTIFICATION_INTERVAL,
|
|
|
+ minNotificationInterval);
|
|
|
+ LOG.info("{}={}", MIN_NOTIFICATION_INTERVAL, minNotificationInterval);
|
|
|
+ maxNotificationInterval = Integer.getInteger(MAX_NOTIFICATION_INTERVAL,
|
|
|
+ maxNotificationInterval);
|
|
|
+ LOG.info("{}={}", MAX_NOTIFICATION_INTERVAL, maxNotificationInterval);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Connection manager. Fast leader election uses TCP for
|
|
@@ -898,7 +925,7 @@ public class FastLeaderElection implements Election {
|
|
|
|
|
|
Map<Long, Vote> outofelection = new HashMap<Long, Vote>();
|
|
|
|
|
|
- int notTimeout = finalizeWait;
|
|
|
+ int notTimeout = minNotificationInterval;
|
|
|
|
|
|
synchronized(this){
|
|
|
logicalclock.incrementAndGet();
|