Package org.oxerr.webmagic.proxy
Class DelayedProxyProvider
java.lang.Object
org.oxerr.webmagic.proxy.DelayedProxyProvider
- All Implemented Interfaces:
Externalizable
,Serializable
,us.codecraft.webmagic.proxy.ProxyProvider
public class DelayedProxyProvider
extends Object
implements us.codecraft.webmagic.proxy.ProxyProvider, Externalizable
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Map<us.codecraft.webmagic.proxy.Proxy,
DelayedProxy> private final org.apache.logging.log4j.Logger
private long
private long
private long
private long
private final DelayQueue<DelayedProxy>
private long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionMap<us.codecraft.webmagic.proxy.Proxy,
DelayedProxy> protected Duration
getDelay
(DelayedProxy delayedProxy, us.codecraft.webmagic.Page page, us.codecraft.webmagic.Task task, boolean success) protected float
getDelayFactor
(DelayedProxy delayedProxy, us.codecraft.webmagic.Page page, us.codecraft.webmagic.Task task, boolean success) us.codecraft.webmagic.proxy.Proxy
getProxy
(us.codecraft.webmagic.Request request, us.codecraft.webmagic.Task task) protected boolean
isSuccess
(us.codecraft.webmagic.proxy.Proxy proxy, us.codecraft.webmagic.Page page, us.codecraft.webmagic.Task task) protected void
void
put
(us.codecraft.webmagic.proxy.Proxy proxy) void
void
returnProxy
(us.codecraft.webmagic.proxy.Proxy proxy, us.codecraft.webmagic.Page page, us.codecraft.webmagic.Task task) void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface us.codecraft.webmagic.proxy.ProxyProvider
getProxy
-
Field Details
-
log
private final transient org.apache.logging.log4j.Logger log -
proxies
-
allProxies
-
minSuccessDelay
private long minSuccessDelay -
maxSuccessDelay
private long maxSuccessDelay -
minFailureDelay
private long minFailureDelay -
maxFailureDelay
private long maxFailureDelay -
waitTimeout
private long waitTimeout
-
-
Constructor Details
-
DelayedProxyProvider
public DelayedProxyProvider() -
DelayedProxyProvider
-
DelayedProxyProvider
-
-
Method Details
-
returnProxy
public void returnProxy(us.codecraft.webmagic.proxy.Proxy proxy, us.codecraft.webmagic.Page page, us.codecraft.webmagic.Task task) - Specified by:
returnProxy
in interfaceus.codecraft.webmagic.proxy.ProxyProvider
-
getProxy
public us.codecraft.webmagic.proxy.Proxy getProxy(us.codecraft.webmagic.Request request, us.codecraft.webmagic.Task task) - Specified by:
getProxy
in interfaceus.codecraft.webmagic.proxy.ProxyProvider
-
put
public void put(us.codecraft.webmagic.proxy.Proxy proxy) -
getProxies
-
getAllProxies
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
getDelay
protected Duration getDelay(DelayedProxy delayedProxy, us.codecraft.webmagic.Page page, us.codecraft.webmagic.Task task, boolean success) -
getDelayFactor
protected float getDelayFactor(DelayedProxy delayedProxy, us.codecraft.webmagic.Page page, us.codecraft.webmagic.Task task, boolean success) -
isSuccess
protected boolean isSuccess(us.codecraft.webmagic.proxy.Proxy proxy, us.codecraft.webmagic.Page page, us.codecraft.webmagic.Task task) -
printInfo
protected void printInfo()
-