public class ConnectionState extends Object
AsyncSocketTransport
.Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_MAX_RETRY_INTERVAL
The default value of maxRetryInterval.
|
static long |
INIT_RETRY_INTERVAL
The starting Retry interval in milliseconds
|
long |
maxRetryInterval
max retry interval for this server.
|
Constructor and Description |
---|
ConnectionState()
Creates a new ConnectionState.
|
Modifier and Type | Method and Description |
---|---|
ConnectionStatus |
checkRetry(AsyncHandler<ConnectionStatus> callBack)
This method is to be called when the getStatus method returns RETRY.
|
long |
getDownSince()
Milliseconds time when the connection was found to be down.
|
static ConnectionState |
getInstance(String serverKey)
Gets the connection state for the given server.
|
long |
getLastDownTime()
Milliseconds time when the connection was found to be down.
|
Throwable |
getLastException()
The last exception for which updateStatus call.
|
long |
getRetryInterval()
Current Retry Interval when retrying broken connections.
|
void |
updateStatus(ConnectionStatus status,
Throwable exception)
Method called to update the connectionStatus after a successful connection or if an error occurs in connection.
|
public static final long INIT_RETRY_INTERVAL
public static final long DEFAULT_MAX_RETRY_INTERVAL
public volatile long maxRetryInterval
public static ConnectionState getInstance(String serverKey)
serverKey
- Server Key in the form host:portpublic ConnectionStatus checkRetry(AsyncHandler<ConnectionStatus> callBack)
callBack
- Callback to be called with the connection status if another connection is making a retry on the same server.public void updateStatus(ConnectionStatus status, Throwable exception)
status
- ConnectionStatus indicating connection statusexception
- Exception which was thrownpublic Throwable getLastException()
public long getRetryInterval()
public long getDownSince()
public long getLastDownTime()
Copyright © 2013- Suresh Mahalingam. All Rights Reserved.