public interface AsyncSocketTransport extends ServerInfo
AsyncRedisConnection
to connect to a Redis Server.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the Socket connection.
|
void |
connect(AsyncHandler<Boolean> handler)
Connects to Socket and calls handler with true on success and false with
Exception on failure.
|
boolean |
flush(AsyncHandler<Integer> handler)
Flushes bytes in buffer to Socket Output.
|
AsyncSocketTransportConfig |
getConfig()
Gets the AsyncSocketTransport config in use.
|
long |
getDownSince()
Returns the millisecond time since this connection was down.
|
long |
getRetryInterval()
The current retry interval as per the exponential fall back calculation.
|
ConnectionStatus |
getStatus()
Returns the Connection Status
|
boolean |
isStale()
Checks if the connection is stale as per configured idle timeout.
|
int |
read(OutputStream dest,
int maxBytes,
AsyncHandler<Integer> handler)
Reads atleast 1 byte and a max of upto maxBytes writing bytes read to specified
Stream.
|
boolean |
requiresFlush()
Whether the Socket Output requires a flush to transfer bytes in buffer.
|
void |
setConfig(AsyncSocketTransportConfig pconfig)
Sets the AsyncSocketTransport config to use.
|
int |
write(byte[] b,
int ofs,
int len,
AsyncHandler<Integer> handler)
Writes specified bytes to Output Stream.
|
getConnectionString, getHost, getPort, getServerIndex
void connect(AsyncHandler<Boolean> handler)
handler
- Handler to callint read(OutputStream dest, int maxBytes, AsyncHandler<Integer> handler)
dest
- OutputStream to write bytes ReadmaxBytes
- max Bytes to readhandler
- handler to call in case of Async operationint write(byte[] b, int ofs, int len, AsyncHandler<Integer> handler)
b
- Byte Array containing bytes to writeofs
- offset to write fromlen
- number of bytes to writehandler
- handler to call in case of Async operation. The handler is
called after all bytes have been written with the number of bytes actaully
transferred to the Socket Output.boolean requiresFlush()
boolean flush(AsyncHandler<Integer> handler)
handler
- Callback handler in case flush is required. The handler is
called with bytes transferred if further flush call is required or a
negative value of -bytes transferred if further flush call is not required.void close() throws IOException
IOException
ConnectionStatus getStatus()
boolean isStale()
AsyncSocketTransportConfig getConfig()
void setConfig(AsyncSocketTransportConfig pconfig)
pconfig
- to uselong getDownSince()
long getRetryInterval()
Copyright © 2013- Suresh Mahalingam. All Rights Reserved.