Package net.rubyeye.xmemcached.impl
Class ReconnectRequest
- java.lang.Object
-
- net.rubyeye.xmemcached.impl.ReconnectRequest
-
- All Implemented Interfaces:
java.lang.Comparable<java.util.concurrent.Delayed>,java.util.concurrent.Delayed
public final class ReconnectRequest extends java.lang.Object implements java.util.concurrent.DelayedA auto reconnect request,associating a socket address for reconnecting
-
-
Field Summary
Fields Modifier and Type Field Description private InetSocketAddressWrapperinetSocketAddressWrapperprivate static longMAX_RECONNECT_INTERVALprivate static longMIN_RECONNECT_INTERVALprivate longnextReconnectTimestampprivate inttries
-
Constructor Summary
Constructors Constructor Description ReconnectRequest(InetSocketAddressWrapper inetSocketAddressWrapper, int tries, long reconnectInterval)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.util.concurrent.Delayed o)longgetDelay(java.util.concurrent.TimeUnit unit)InetSocketAddressWrappergetInetSocketAddressWrapper()Returns a reconnect socket address wrapperintgetTries()Returns retry timesprivate longnormalInterval(long reconnectInterval)voidsetInetSocketAddressWrapper(InetSocketAddressWrapper inetSocketAddressWrapper)voidsetTries(int tries)voidupdateNextReconnectTimeStamp(long interval)
-
-
-
Field Detail
-
inetSocketAddressWrapper
private InetSocketAddressWrapper inetSocketAddressWrapper
-
tries
private int tries
-
MIN_RECONNECT_INTERVAL
private static final long MIN_RECONNECT_INTERVAL
- See Also:
- Constant Field Values
-
MAX_RECONNECT_INTERVAL
private static final long MAX_RECONNECT_INTERVAL
- See Also:
- Constant Field Values
-
nextReconnectTimestamp
private volatile long nextReconnectTimestamp
-
-
Constructor Detail
-
ReconnectRequest
public ReconnectRequest(InetSocketAddressWrapper inetSocketAddressWrapper, int tries, long reconnectInterval)
-
-
Method Detail
-
normalInterval
private long normalInterval(long reconnectInterval)
-
getDelay
public long getDelay(java.util.concurrent.TimeUnit unit)
- Specified by:
getDelayin interfacejava.util.concurrent.Delayed
-
compareTo
public int compareTo(java.util.concurrent.Delayed o)
- Specified by:
compareToin interfacejava.lang.Comparable<java.util.concurrent.Delayed>
-
getInetSocketAddressWrapper
public final InetSocketAddressWrapper getInetSocketAddressWrapper()
Returns a reconnect socket address wrapper- Returns:
- See Also:
InetSocketAddressWrapper
-
updateNextReconnectTimeStamp
public void updateNextReconnectTimeStamp(long interval)
-
setInetSocketAddressWrapper
public final void setInetSocketAddressWrapper(InetSocketAddressWrapper inetSocketAddressWrapper)
-
setTries
public final void setTries(int tries)
-
getTries
public final int getTries()
Returns retry times- Returns:
- retry times,it is zero if it does not retry to connect
-
-