summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2024-12-12 09:03:28 +0100
committerGitHub <noreply@github.com>2024-12-12 09:03:28 +0100
commitf55aaed2d41388712ec0cc90055831dae5d57896 (patch)
treec28edd1729da8c44b549765e7650aea46c4db8ae
parent8bbc3de611f9a679b5fb542241d32f887b4fe921 (diff)
Solved a small bug that let FlowNodes update while they are in a closed state. (#283)
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimTraceWorkload.java3
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowNode.java5
2 files changed, 8 insertions, 0 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimTraceWorkload.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimTraceWorkload.java
index 72c095dc..fbbe0815 100644
--- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimTraceWorkload.java
+++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimTraceWorkload.java
@@ -245,6 +245,9 @@ public class SimTraceWorkload extends SimWorkload implements FlowConsumer {
*/
@Override
public void removeSupplierEdge(FlowEdge supplierEdge) {
+ if (this.machineEdge == null) {
+ return;
+ }
this.stopWorkload();
}
}
diff --git a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowNode.java b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowNode.java
index 6ee947bc..b2827130 100644
--- a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowNode.java
+++ b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowNode.java
@@ -157,6 +157,11 @@ public abstract class FlowNode {
* Update the state of the stage.
*/
public void update(long now) {
+ if (this.nodeState == NodeState.CLOSED) {
+ this.deadline = Long.MAX_VALUE;
+ return;
+ }
+
this.nodeState = NodeState.UPDATING;
long newDeadline = this.deadline;