@PrivateApi public interface ConnectionManager extends ConnectionListenable
Connection
objects.Modifier and Type | Method and Description |
---|---|
int |
getActiveConnectionCount()
Gets the number of active connections.
|
int |
getAllTextConnections()
Gets the number of text connections (rest/memcache)
|
Connection |
getConnection(Address address)
Gets the connection for a given address.
|
int |
getConnectionCount()
Gets the total number of connections.
|
int |
getCurrentClientConnections()
Gets the number of client connections.
|
Connection |
getOrConnect(Address address)
Gets the existing connection for a given address or connects.
|
Connection |
getOrConnect(Address address,
boolean silent)
Gets the existing connection for a given address.
|
void |
onConnectionClose(Connection connection)
Deals with cleaning up a closed connection.
|
boolean |
registerConnection(Address address,
Connection connection) |
void |
shutdown()
Shutdowns ConnectionManager completely.
|
void |
start()
Starts ConnectionManager, initializes its resources, starts threads, etc.
|
void |
stop()
Stops ConnectionManager, releases its resources, stops threads, etc.
|
boolean |
transmit(Packet packet,
Address target)
Transmits a packet to a certain address.
|
boolean |
transmit(Packet packet,
Connection connection)
Transmits a packet to a certain connection.
|
addConnectionListener
int getCurrentClientConnections()
int getAllTextConnections()
int getConnectionCount()
int getActiveConnectionCount()
Connection getConnection(Address address)
address
- the remote side of the connectionConnection getOrConnect(Address address)
address
- the address to connect tonull
if no connection existsgetOrConnect(Address, boolean)
Connection getOrConnect(Address address, boolean silent)
null
.
When the connection is established at some point in time, it can be retrieved using the
getConnection(Address)
.
address
- the address to connect tosilent
- if logging should be done on debug level (silent=true
) or on info level (silent=false
)boolean registerConnection(Address address, Connection connection)
void onConnectionClose(Connection connection)
Connection.close(String, Throwable)
method where it is protected against multiple closes.boolean transmit(Packet packet, Connection connection)
If this method is called with a null
connection, the call returns false
.
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)NullPointerException
- if the packet is null
boolean transmit(Packet packet, Address target)
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.
packet
- The Packet to transmit.target
- The address of the target machine where the Packet should be transmitted.NullPointerException
- if packet or target is null.transmit(com.hazelcast.nio.Packet, com.hazelcast.nio.Connection)
void start()
If it is already started, then this method has no effect.
IllegalStateException
- if ConnectionManager is shutdownvoid stop()
start()
.
This method has no effect if it is already stopped or shutdown.
Currently stop
is called during the merge process to detach node from the current cluster. After
node becomes ready to join to the new cluster, start
is called to re-initialize the ConnectionManager.
void shutdown()
This method has no effect if it is already shutdown.
Copyright © 2018 Hazelcast, Inc.. All rights reserved.