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.Delayed
A auto reconnect request,associating a socket address for reconnecting
-
-
Field Summary
Fields Modifier and Type Field Description private InetSocketAddressWrapper
inetSocketAddressWrapper
private static long
MAX_RECONNECT_INTERVAL
private static long
MIN_RECONNECT_INTERVAL
private long
nextReconnectTimestamp
private int
tries
-
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 int
compareTo(java.util.concurrent.Delayed o)
long
getDelay(java.util.concurrent.TimeUnit unit)
InetSocketAddressWrapper
getInetSocketAddressWrapper()
Returns a reconnect socket address wrapperint
getTries()
Returns retry timesprivate long
normalInterval(long reconnectInterval)
void
setInetSocketAddressWrapper(InetSocketAddressWrapper inetSocketAddressWrapper)
void
setTries(int tries)
void
updateNextReconnectTimeStamp(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:
getDelay
in interfacejava.util.concurrent.Delayed
-
compareTo
public int compareTo(java.util.concurrent.Delayed o)
- Specified by:
compareTo
in 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
-
-