Package ai.platon.pulsar.common.proxy
Class LoadingProxyPool
-
- All Implemented Interfaces:
-
java.lang.AutoCloseable
public final class LoadingProxyPool extends ProxyPool
Manage all external proxies. Check all unavailable proxies, recover them if possible. This might take a long time, so it should be run in a separate thread.
-
-
Field Summary
Fields Modifier and Type Field Description private final ProxyLoaderproxyLoaderprivate final BooleanisActiveprivate InstantlastActiveTimeprivate final Integersize
-
Constructor Summary
Constructors Constructor Description LoadingProxyPool(ProxyLoader proxyLoader, ImmutableConfig conf)
-
Method Summary
Modifier and Type Method Description final ProxyLoadergetProxyLoader()ProxyEntrytake()Try to take a proxy from the pool, if the pool is empty, load proxies using a ProxyLoader. Unitretire(ProxyEntry proxyEntry)The proxy may be recovered later Unitreport(ProxyEntry proxyEntry)Unitdump()StringtoString()-
Methods inherited from class ai.platon.pulsar.common.proxy.ProxyPool
clear, close, contains, getLastActiveTime, getSize, isActive, isEmpty, iterator, offer, setLastActiveTime -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
LoadingProxyPool
LoadingProxyPool(ProxyLoader proxyLoader, ImmutableConfig conf)
-
-
Method Detail
-
getProxyLoader
final ProxyLoader getProxyLoader()
-
take
ProxyEntry take()
Try to take a proxy from the pool, if the pool is empty, load proxies using a ProxyLoader.
-
retire
Unit retire(ProxyEntry proxyEntry)
The proxy may be recovered later
-
report
Unit report(ProxyEntry proxyEntry)
-
-
-
-