From 26de8850def6af9eff0db38de7d17fb352f5d5f3 Mon Sep 17 00:00:00 2001 From: Nikita Sokolov Date: Sat, 6 Feb 2021 20:02:19 +0300 Subject: [PATCH] LocalRuntime defaultMinimalTime --- .../spbsu/flamestream/runtime/FlameUmbrella.java | 10 ++++++---- .../com/spbsu/flamestream/runtime/LocalRuntime.java | 13 ++++++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/runtime/src/test/java/com/spbsu/flamestream/runtime/FlameUmbrella.java b/runtime/src/test/java/com/spbsu/flamestream/runtime/FlameUmbrella.java index 649db5a49..855e8078d 100644 --- a/runtime/src/test/java/com/spbsu/flamestream/runtime/FlameUmbrella.java +++ b/runtime/src/test/java/com/spbsu/flamestream/runtime/FlameUmbrella.java @@ -58,7 +58,8 @@ private Cluster( int millisBetweenCommits, SystemConfig.Acking acking, boolean blinking, - int blinkPeriodSec + int blinkPeriodSec, + long defaultMinimalTime ) { this.blinking = blinking; this.blinkPeriodSec = blinkPeriodSec; @@ -82,7 +83,6 @@ private Cluster( ranges.put(id, new HashGroup(Collections.singleton(range))); } final ClusterConfig clusterConfig = new ClusterConfig(paths, "node-0"); - final int defaultMinimalTime = 0; final SystemConfig systemConfig = new SystemConfig( maxElementsInGraph, @@ -169,7 +169,8 @@ static Props props(Graph g, int millisBetweenCommits, SystemConfig.Acking acking, boolean blinking, - int blinkPeriodSec + int blinkPeriodSec, + long defaultMinimalTime ) { return Props.create( Cluster.class, @@ -181,7 +182,8 @@ static Props props(Graph g, millisBetweenCommits, acking, blinking, - blinkPeriodSec + blinkPeriodSec, + defaultMinimalTime ); } diff --git a/runtime/src/test/java/com/spbsu/flamestream/runtime/LocalRuntime.java b/runtime/src/test/java/com/spbsu/flamestream/runtime/LocalRuntime.java index 3b8cc2df6..c1647064f 100644 --- a/runtime/src/test/java/com/spbsu/flamestream/runtime/LocalRuntime.java +++ b/runtime/src/test/java/com/spbsu/flamestream/runtime/LocalRuntime.java @@ -31,6 +31,7 @@ public class LocalRuntime implements FlameRuntime { private final boolean barrierDisabled; private final boolean blinking; private final int blinkPeriodSec; + private final long defaultMinimalTime; private LocalRuntime( ActorSystem system, @@ -40,6 +41,7 @@ private LocalRuntime( int millisBetweenCommits, boolean blinking, int blinkPeriodSec, + long defaultMinimalTime, SystemConfig.Acking acking, StateStorage stateStorage ) { @@ -50,6 +52,7 @@ private LocalRuntime( this.millisBetweenCommits = millisBetweenCommits; this.system = system; this.blinkPeriodSec = blinkPeriodSec; + this.defaultMinimalTime = defaultMinimalTime; this.acking = acking; this.stateStorage = stateStorage; } @@ -70,7 +73,8 @@ public Flame run(Graph g) { millisBetweenCommits, acking, blinking, - blinkPeriodSec + blinkPeriodSec, + defaultMinimalTime ), "restarter" ); @@ -122,6 +126,7 @@ public static class Builder { private int blinkPeriodSec = 10; private SystemConfig.Acking acking = SystemConfig.Acking.CENTRALIZED; private StateStorage stateStorage = new InMemStateStorage(); + private long defaultMinimalTime = 0; @Nullable private ActorSystem system = null; @@ -147,6 +152,11 @@ public Builder blinkPeriodSec(int blinkPeriodSec) { return this; } + public Builder defaultMinimalTime(long defaultMinimalTime) { + this.defaultMinimalTime = defaultMinimalTime; + return this; + } + public Builder withStateStorage(StateStorage stateStorage) { this.stateStorage = stateStorage; return this; @@ -184,6 +194,7 @@ public LocalRuntime build() { millisBetweenCommits, blinking, blinkPeriodSec, + defaultMinimalTime, acking, stateStorage );