me.xethh.libs.toolkits.stopWatchEx.StopWatchExWithLoggerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons Show documentation
Show all versions of commons Show documentation
Library of common used tools - major focus on common tools
package me.xethh.libs.toolkits.stopWatchEx;
import me.xethh.libs.toolkits.cache.LRUCache;
import org.slf4j.Logger;
import java.util.function.Supplier;
public class StopWatchExWithLoggerFactory {
public StopWatchExWithLoggerFactory(Logger logger, Supplier stopWatchExSupplier){
this(logger, stopWatchExSupplier, 5,5);
}
public StopWatchExWithLoggerFactory(Logger logger, Supplier stopWatchExSupplier, int init, int maxEntry){
this.builder = stopWatchExSupplier;
cache = new LRUCache.LRUMap<>(init, maxEntry);
}
private Supplier builder;
private Logger logger;
public StopWatchEx getNewOne(){
return builder.get();
}
private LRUCache.LRUMap cache;
public static StopWatchExWithLoggerFactory getWithLabel(Logger logger, Supplier builder, int init, int maxEntry){
return new StopWatchExWithLoggerFactory(logger, builder, init, maxEntry);
}
public static StopWatchExWithLoggerFactory getWithLabel(Logger logger, Supplier builder){
return new StopWatchExWithLoggerFactory(logger, builder);
}
}