public class TcpIpEndpointManager extends Object implements EndpointManager<TcpIpConnection>, Consumer<Packet>
Modifier and Type | Class and Description |
---|---|
class |
TcpIpEndpointManager.EndpointConnectionLifecycleListener |
Modifier and Type | Method and Description |
---|---|
void |
accept(Packet packet)
Performs this operation on the given argument.
|
void |
addConnectionListener(ConnectionListener listener)
Registers a ConnectionListener.
|
Collection<TcpIpConnection> |
getActiveConnections()
Returns all connections bind or not that are currently holding resources on this member.
|
TcpIpConnection |
getConnection(Address address)
Gets the connection for a given address.
|
Collection<TcpIpConnection> |
getConnections()
Returns connections that have been successfully established (ie.
|
EndpointQualifier |
getEndpointQualifier() |
NetworkingService |
getNetworkingService() |
TcpIpConnection |
getOrConnect(Address address)
Gets the existing connection for a given address or connects.
|
TcpIpConnection |
getOrConnect(Address address,
boolean silent)
Gets the existing connection for a given address.
|
boolean |
registerConnection(Address remoteEndPoint,
TcpIpConnection connection)
Registers (ie.
|
void |
reset(boolean cleanListeners) |
String |
toString() |
boolean |
transmit(Packet packet,
Address target)
Transmits a packet to a certain address.
|
boolean |
transmit(Packet packet,
TcpIpConnection connection)
Transmits a packet to a certain connection.
|
public NetworkingService getNetworkingService()
public EndpointQualifier getEndpointQualifier()
public Collection<TcpIpConnection> getActiveConnections()
EndpointManager
getActiveConnections
in interface EndpointManager<TcpIpConnection>
public Collection<TcpIpConnection> getConnections()
EndpointManager
getConnections
in interface EndpointManager<TcpIpConnection>
public void addConnectionListener(ConnectionListener listener)
ConnectionListenable
addConnectionListener
in interface ConnectionListenable
listener
- the ConnectionListener to add.public void accept(Packet packet)
Consumer
public TcpIpConnection getConnection(Address address)
EndpointManager
getConnection
in interface EndpointManager<TcpIpConnection>
address
- the remote side of the connectionpublic TcpIpConnection getOrConnect(Address address)
EndpointManager
getOrConnect
in interface EndpointManager<TcpIpConnection>
address
- the address to connect tonull
if no connection existsEndpointManager.getOrConnect(Address, boolean)
public TcpIpConnection getOrConnect(Address address, boolean silent)
EndpointManager
null
.
When the connection is established at some point in time, it can be retrieved using the
EndpointManager.getConnection(Address)
.
getOrConnect
in interface EndpointManager<TcpIpConnection>
address
- the address to connect tosilent
- if logging should be done on debug level (silent=true
) or on info level (silent=false
)public boolean registerConnection(Address remoteEndPoint, TcpIpConnection connection)
EndpointManager
EndpointManager.getConnection(Address)
will return
the relevant Connection
resource.registerConnection
in interface EndpointManager<TcpIpConnection>
remoteEndPoint
- - The remote endpoint to register the connection underconnection
- - The connection to be registeredpublic void reset(boolean cleanListeners)
public boolean transmit(Packet packet, TcpIpConnection connection)
EndpointManager
If this method is called with a null
connection, the call returns false
.
transmit
in interface EndpointManager<TcpIpConnection>
packet
- the packet to transmitconnection
- he connection to where the Packet should be transmittedtrue
if the transmit was a success, false
if a failure (there is no guarantee that the packet is
actually going to be received since the packet perhaps is stuck in some buffer; it just means that it's buffered somewhere)public boolean transmit(Packet packet, Address target)
EndpointManager
If the connection to the target doesn't exist yet, the system will try to make the connection. In this case true can be returned, even though the connection eventually can't be established.
transmit
in interface EndpointManager<TcpIpConnection>
packet
- The Packet to transmit.target
- The address of the target machine where the Packet should be transmitted.EndpointManager.transmit(com.hazelcast.nio.Packet, com.hazelcast.nio.Connection)
Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.