ru.fix.stdlib.reference.GarbageGenerator Maven / Gradle / Ivy
package ru.fix.stdlib.reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.function.Supplier;
public class GarbageGenerator {
private static final Logger log = LoggerFactory.getLogger(GarbageGenerator.class);
private Duration timeout = Duration.ofMinutes(1);
private Duration delay = Duration.ofMillis(100);
private int garbageSizePerIterationMB = 10;
public GarbageGenerator setTimeout(Duration timeout) {
this.timeout = timeout;
return this;
}
public GarbageGenerator setDelay(Duration delay) {
this.delay = delay;
return this;
}
public GarbageGenerator setGarbageSizePerIterationMB(int garbageSizePerIterationMB) {
this.garbageSizePerIterationMB = garbageSizePerIterationMB;
return this;
}
public boolean generateGarbageAndWaitForCondition(Supplier condition) throws Exception {
ArrayList
© 2015 - 2025 Weber Informatics LLC | Privacy Policy