com.github.skjolber.packing.deadline.DelegateDeadlineCheckPackagerInterruptSupplier Maven / Gradle / Ivy
package com.github.skjolber.packing.deadline;
import java.util.function.BooleanSupplier;
public class DelegateDeadlineCheckPackagerInterruptSupplier implements PackagerInterruptSupplier {
protected final BooleanSupplier delegate;
protected final long deadline;
public DelegateDeadlineCheckPackagerInterruptSupplier(long deadline, BooleanSupplier delegate) {
super();
this.deadline = deadline;
this.delegate = delegate;
}
@Override
public boolean getAsBoolean() {
return delegate.getAsBoolean() || System.currentTimeMillis() > deadline;
}
}