public class ClientConnection extends Object implements Connection, Closeable
| Modifier and Type | Field and Description |
|---|---|
protected int |
connectionId |
| Constructor and Description |
|---|
ClientConnection(HazelcastClientInstanceImpl client,
int connectionId) |
ClientConnection(HazelcastClientInstanceImpl client,
NonBlockingIOThread in,
NonBlockingIOThread out,
int connectionId,
SocketChannelWrapper socketChannelWrapper) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this connection.
|
void |
close(Throwable t) |
void |
decrementPendingPacketCount() |
boolean |
equals(Object o) |
long |
getClosedTime() |
ClientConnectionManager |
getConnectionManager() |
Address |
getEndPoint()
Gets the
Address of the other side of this Connection. |
InetAddress |
getInetAddress()
Returns remote address of this Connection.
|
InetSocketAddress |
getLocalSocketAddress() |
int |
getPendingPacketCount() |
int |
getPort()
The remote port.
|
ClientReadHandler |
getReadHandler() |
Address |
getRemoteEndpoint() |
InetSocketAddress |
getRemoteSocketAddress()
Returns the address of the endpoint this Connection is connected to, or
null if it is unconnected. |
SerializationService |
getSerializationService() |
SocketChannelWrapper |
getSocketChannelWrapper() |
ConnectionType |
getType()
Returns the
ConnectionType of this Connection. |
int |
hashCode() |
void |
incrementPendingPacketCount() |
void |
init() |
protected void |
innerClose() |
boolean |
isAlive()
Checks if the Connection is alive.
|
boolean |
isAuthenticatedAsOwner() |
boolean |
isClient()
Checks if it is a client connection.
|
boolean |
isHeartBeating() |
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 |
setIsAuthenticatedAsOwner() |
void |
setRemoteEndpoint(Address remoteEndpoint) |
void |
setType(ConnectionType type)
Sets the type of the connection
|
String |
toString() |
boolean |
write(OutboundFrame frame)
Writes a outbound frame so it can be received by the other side of the connection.
|
public ClientConnection(HazelcastClientInstanceImpl client, NonBlockingIOThread in, NonBlockingIOThread out, int connectionId, SocketChannelWrapper socketChannelWrapper) throws IOException
IOExceptionpublic ClientConnection(HazelcastClientInstanceImpl client, int connectionId) throws IOException
IOExceptionpublic void incrementPendingPacketCount()
public void decrementPendingPacketCount()
public int getPendingPacketCount()
public SerializationService getSerializationService()
public boolean write(OutboundFrame frame)
ConnectionThe frame could be stored in an internal queue before it actually is written, so this call does not need to be a synchronous call.
write in interface Connectionframe - the frame to write.public void init()
throws IOException
IOExceptionpublic Address getEndPoint()
ConnectionAddress of the other side of this Connection.
todo: rename to get remoteAddress?
getEndPoint in interface Connectionpublic boolean isAlive()
ConnectionisAlive in interface Connectionpublic long lastReadTimeMillis()
ConnectionlastReadTimeMillis in interface Connectionpublic long lastWriteTimeMillis()
ConnectionlastWriteTimeMillis in interface Connectionpublic void close()
ConnectionPending packets on this connection are discarded
If the Connection is already closed, the call is ignored. So it can safely be called multiple times.
close in interface Connectionclose in interface Closeableclose in interface AutoCloseablepublic void setType(ConnectionType type)
ConnectionsetType in interface Connectiontype - to be setpublic ConnectionType getType()
ConnectionConnectionType of this Connection.getType in interface Connectionnull is returned.public boolean isClient()
ConnectionisClient in interface Connectionpublic InetAddress getInetAddress()
ConnectiongetInetAddress in interface Connectionnull if the connection is not alive.public InetSocketAddress getRemoteSocketAddress()
Connectionnull if it is unconnected.getRemoteSocketAddress in interface Connectiontodo: do we really need this method because we have getInetAddress, InetSocketAddress and getEndPoint.
public int getPort()
Connectiontodo: 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
getPort in interface Connectionpublic SocketChannelWrapper getSocketChannelWrapper()
public ClientConnectionManager getConnectionManager()
public ClientReadHandler getReadHandler()
public void setRemoteEndpoint(Address remoteEndpoint)
public Address getRemoteEndpoint()
public InetSocketAddress getLocalSocketAddress()
protected void innerClose()
throws IOException
IOExceptionpublic void close(Throwable t)
public boolean isHeartBeating()
public boolean isAuthenticatedAsOwner()
public void setIsAuthenticatedAsOwner()
public long getClosedTime()
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.