com.xzchaoo.commons.syncexclusiveexecutor.Limiter Maven / Gradle / Ivy
The newest version!
package com.xzchaoo.commons.syncexclusiveexecutor;
/**
* created at 2020/7/25
*
* @author xzchaoo
*/
@FunctionalInterface
public interface Limiter {
Limit limit(int type);
class Fixed implements Limiter {
private final Limit limit;
public Fixed(int maxExecuted, int maxWip, int maxTime) {
if (maxExecuted < 1) {
throw new IllegalArgumentException("maxExecuted < 1");
}
this.limit = new Limit(maxExecuted, maxWip, maxTime);
}
@Override
public Limit limit(int type) {
return limit;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy