in src/main/java/org/apache/accumulo/testing/gcs/Generator.java [56:87]
private void run() {
// This holds future work to do.
List<Queue<Mutator>> allActions = new ArrayList<>();
int workCreated = 0;
clientId = Math.abs(rand.nextLong());
while (workCreated == 0 || !allActions.isEmpty()) {
while (workCreated < maxWork && allActions.size() < maxActiveWork) {
allActions.add(createWork());
workCreated++;
}
int index = rand.nextInt(allActions.size());
Queue<Mutator> queue = allActions.get(index);
int numToRun = Math.max(1, rand.nextInt(queue.size()));
// By selecting a random queue of work do to do and taking a random number of steps off the
// queue we are randomly interleaving unrelated work over time.
for (int i = 0; i < numToRun; i++) {
queue.remove().run(persistence);
}
if (queue.isEmpty()) {
allActions.set(index, allActions.get(allActions.size() - 1));
allActions.remove(allActions.size() - 1);
}
}
}