PoolEntry(final T route, final TimeValue timeToLive, final Supplier<Long> currentTimeSupplier) { super(); this.route = Args.notNull(route, "Route"); this.timeToLive = TimeValue.defaultsToNegativeOneMillisecond(timeToLive); this.connRef = new AtomicReference<>(null); this.currentTimeSupplier = currentTimeSupplier; }
PoolEntry(final T route, final TimeValue timeToLive, final Supplier<Long> currentTimeSupplier) { super(); this.route = Args.notNull(route, "Route"); this.timeToLive = TimeValue.defaultsToNegativeOneMillisecond(timeToLive); this.connRef = new AtomicReference<>(null); this.currentTimeSupplier = currentTimeSupplier; }
/** * @since 5.0 */ public LaxConnPool( final int defaultMaxPerRoute, final TimeValue timeToLive, final PoolReusePolicy policy, final ConnPoolListener<T> connPoolListener) { super(); Args.positive(defaultMaxPerRoute, "Max per route value"); this.timeToLive = TimeValue.defaultsToNegativeOneMillisecond(timeToLive); this.connPoolListener = connPoolListener; this.policy = policy != null ? policy : PoolReusePolicy.LIFO; this.routeToPool = new ConcurrentHashMap<>(); this.isShutDown = new AtomicBoolean(false); this.defaultMaxPerRoute = defaultMaxPerRoute; }
/** * @since 5.0 */ public LaxConnPool( final int defaultMaxPerRoute, final TimeValue timeToLive, final PoolReusePolicy policy, final ConnPoolListener<T> connPoolListener) { super(); Args.positive(defaultMaxPerRoute, "Max per route value"); this.timeToLive = TimeValue.defaultsToNegativeOneMillisecond(timeToLive); this.connPoolListener = connPoolListener; this.policy = policy != null ? policy : PoolReusePolicy.LIFO; this.routeToPool = new ConcurrentHashMap<>(); this.isShutDown = new AtomicBoolean(false); this.defaultMaxPerRoute = defaultMaxPerRoute; }
/** * @since 5.0 */ public StrictConnPool( final int defaultMaxPerRoute, final int maxTotal, final TimeValue timeToLive, final PoolReusePolicy policy, final ConnPoolListener<T> connPoolListener) { super(); Args.positive(defaultMaxPerRoute, "Max per route value"); Args.positive(maxTotal, "Max total value"); this.timeToLive = TimeValue.defaultsToNegativeOneMillisecond(timeToLive); this.connPoolListener = connPoolListener; this.policy = policy != null ? policy : PoolReusePolicy.LIFO; this.routeToPool = new HashMap<>(); this.leasingRequests = new LinkedList<>(); this.leased = new HashSet<>(); this.available = new LinkedList<>(); this.completedRequests = new ConcurrentLinkedQueue<>(); this.maxPerRoute = new HashMap<>(); this.lock = new ReentrantLock(); this.isShutDown = new AtomicBoolean(false); this.defaultMaxPerRoute = defaultMaxPerRoute; this.maxTotal = maxTotal; }
/** * @since 5.0 */ public StrictConnPool( final int defaultMaxPerRoute, final int maxTotal, final TimeValue timeToLive, final PoolReusePolicy policy, final ConnPoolListener<T> connPoolListener) { super(); Args.positive(defaultMaxPerRoute, "Max per route value"); Args.positive(maxTotal, "Max total value"); this.timeToLive = TimeValue.defaultsToNegativeOneMillisecond(timeToLive); this.connPoolListener = connPoolListener; this.policy = policy != null ? policy : PoolReusePolicy.LIFO; this.routeToPool = new HashMap<>(); this.leasingRequests = new LinkedList<>(); this.leased = new HashSet<>(); this.available = new LinkedList<>(); this.completedRequests = new ConcurrentLinkedQueue<>(); this.maxPerRoute = new HashMap<>(); this.lock = new ReentrantLock(); this.isShutDown = new AtomicBoolean(false); this.defaultMaxPerRoute = defaultMaxPerRoute; this.maxTotal = maxTotal; }
public IOReactorConfig build() { return new IOReactorConfig( selectInterval != null ? selectInterval : TimeValue.ofSeconds(1), ioThreadCount, Timeout.defaultsToDisabled(soTimeout), soReuseAddress, TimeValue.defaultsToNegativeOneMillisecond(soLinger), soKeepAlive, tcpNoDelay, sndBufSize, rcvBufSize, backlogSize, socksProxyAddress, socksProxyUsername, socksProxyPassword); }
public IOReactorConfig build() { return new IOReactorConfig( selectInterval != null ? selectInterval : TimeValue.ofSeconds(1), ioThreadCount, Timeout.defaultsToDisabled(soTimeout), soReuseAddress, TimeValue.defaultsToNegativeOneMillisecond(soLinger), soKeepAlive, tcpNoDelay, sndBufSize, rcvBufSize, backlogSize); }