public interface Connection
TcpIpConnection
.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this connection.
|
Address |
getEndPoint()
Gets the
Address of the other side of this Connection. |
InetAddress |
getInetAddress()
Returns remote address of this Connection.
|
int |
getPort()
The remote port.
|
InetSocketAddress |
getRemoteSocketAddress()
Returns the address of the endpoint this Connection is connected to, or
null if it is unconnected. |
ConnectionType |
getType()
Returns the
ConnectionType of this Connection. |
boolean |
isAlive()
Checks if the Connection is alive.
|
boolean |
isClient()
Checks if it is a client connection.
|
long |
lastReadTimeMillis()
Returns the clock time in milliseconds of the most recent read using this connection.
|
long |
lastWriteTimeMillis()
Returns the clock time in milliseconds of the most recent write using this connection.
|
void |
setType(ConnectionType type)
Sets the type of the connection
|
boolean |
write(OutboundFrame frame)
Writes a outbound frame so it can be received by the other side of the connection.
|
boolean isAlive()
long lastReadTimeMillis()
long lastWriteTimeMillis()
ConnectionType getType()
ConnectionType
of this Connection.null
is returned.void setType(ConnectionType type)
type
- to be setboolean isClient()
InetAddress getInetAddress()
null
if the connection is not alive.InetSocketAddress getRemoteSocketAddress()
null
if it is unconnected.todo: do we really need this method because we have getInetAddress, InetSocketAddress and getEndPoint.
Address getEndPoint()
Address
of the other side of this Connection.
todo: rename to get remoteAddress?
int getPort()
todo: rename to getRemotePort? And do we need it because we already have getEndPoint which returns an address which includes port. It is only used in testing
boolean write(OutboundFrame frame)
The frame could be stored in an internal queue before it actually is written, so this call does not need to be a synchronous call.
frame
- the frame to write.NullPointerException
- if frame is null.void close()
Pending packets on this connection are discarded
If the Connection is already closed, the call is ignored. So it can safely be called multiple times.
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.