Commit 9dcb8a5e authored by Nils Richerzhagen's avatar Nils Richerzhagen
Browse files

Added insanity checks to MaxPeerCount churn generator.

parent 385d07ac
...@@ -79,6 +79,8 @@ public class MaxPeerCountChurnGenerator ...@@ -79,6 +79,8 @@ public class MaxPeerCountChurnGenerator
private final String SEP = ","; private final String SEP = ",";
private final long _minBurstLength = 10 * Time.MINUTE; private final long _minBurstLength = 10 * Time.MINUTE;
private final int maxNumberOfNodes;
/** /**
* {@link ChurnInfo} from the csv file. * {@link ChurnInfo} from the csv file.
...@@ -99,8 +101,9 @@ public class MaxPeerCountChurnGenerator ...@@ -99,8 +101,9 @@ public class MaxPeerCountChurnGenerator
} }
}; };
@XMLConfigurableConstructor({ "file" }) @XMLConfigurableConstructor({ "file", "maxNumberOfNodes"})
public MaxPeerCountChurnGenerator(String file) { public MaxPeerCountChurnGenerator(String file, int maxNumberOfNodes) {
this.maxNumberOfNodes = maxNumberOfNodes;
parseTrace(file); parseTrace(file);
} }
...@@ -330,6 +333,10 @@ public class MaxPeerCountChurnGenerator ...@@ -330,6 +333,10 @@ public class MaxPeerCountChurnGenerator
assert burstLength >= _minBurstLength : "The minimal length of the burst must be at least 10m."; assert burstLength >= _minBurstLength : "The minimal length of the burst must be at least 10m.";
assert numberOfClients > 0: "Number of nodes must be positive.";
assert numberOfClients <= maxNumberOfNodes : "Cannot configure more nodes than configured in configuration.";
previousEndTime = startTime + burstLength; previousEndTime = startTime + burstLength;
churnInfos.add(new ChurnInfo(startTime, burstLength, churnInfos.add(new ChurnInfo(startTime, burstLength,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment