@PrivateApi public interface Connection
TcpIpConnection
.Modifier and Type | Method and Description |
---|---|
void |
close(String reason,
Throwable cause)
Closes this connection.
|
Throwable |
getCloseCause()
Gets the cause this Connection was closed.
|
String |
getCloseReason()
Gets the reason this Connection was closed.
|
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(com.hazelcast.internal.networking.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(com.hazelcast.internal.networking.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(String reason, Throwable cause)
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.
reason
- the reason this connection is going to be closed. Is allowed to be null.cause
- the Throwable responsible for closing this connection. Is allowed to be null.String getCloseReason()
getCloseCause()
,
close(String, Throwable)
Throwable getCloseCause()
()
,
close(String, Throwable)
Copyright © 2018 Hazelcast, Inc.. All rights reserved.