Magic numbers are bad! (Bad Juju!!) A step closer to being configurable.
Change-Id: I12e0115301cf02b8cb5af23d4d441efd82b4a3d1
diff --git a/apps/mlb/src/main/java/org/onosproject/mlb/MastershipLoadBalancer.java b/apps/mlb/src/main/java/org/onosproject/mlb/MastershipLoadBalancer.java
index b2a33a9..22947fe 100644
--- a/apps/mlb/src/main/java/org/onosproject/mlb/MastershipLoadBalancer.java
+++ b/apps/mlb/src/main/java/org/onosproject/mlb/MastershipLoadBalancer.java
@@ -55,6 +55,8 @@
private final Logger log = getLogger(getClass());
+ // TODO: parameterize via component config
+ private static final int SCHEDULE_PERIOD = 5;
private static final String REBALANCE_MASTERSHIP = "rebalance/mastership";
private NodeId localId;
@@ -120,8 +122,9 @@
private void scheduleBalance() {
if (isLeader.get() && nextTask.get() == null) {
- ListenableScheduledFuture task = executorService.schedule(mastershipAdminService::balanceRoles, 30,
- TimeUnit.SECONDS);
+ ListenableScheduledFuture task =
+ executorService.schedule(mastershipAdminService::balanceRoles,
+ SCHEDULE_PERIOD, TimeUnit.SECONDS);
task.addListener(() -> {
log.info("Completed balance roles");
nextTask.set(null);