public class ClientConnectionManagerImpl extends Object implements ClientConnectionManager
ClientConnectionManager
.Modifier and Type | Field and Description |
---|---|
protected boolean |
alive |
protected AtomicInteger |
connectionIdGen |
Constructor and Description |
---|
ClientConnectionManagerImpl(HazelcastClientInstanceImpl client,
AddressTranslator addressTranslator) |
Modifier and Type | Method and Description |
---|---|
void |
addConnectionHeartbeatListener(ConnectionHeartbeatListener connectionHeartbeatListener) |
void |
addConnectionListener(ConnectionListener connectionListener)
Registers a ConnectionListener.
|
protected ClientConnection |
createSocketConnection(Address address) |
void |
destroyConnection(Connection connection,
String reason,
Throwable cause)
Destroys the connection
Clears related resources of given connection.
|
ClientConnection |
getConnection(Address target) |
Connection |
getOrConnect(Address address,
boolean asOwner) |
Connection |
getOrTriggerConnect(Address target,
boolean asOwner) |
void |
handleClientMessage(ClientMessage message,
Connection connection)
Handles incoming network package
|
protected void |
initializeSelectors(HazelcastClientInstanceImpl client) |
boolean |
isAlive()
Check if client connection manager is alive.
|
void |
shutdown()
Shutdown clientConnectionManager
|
protected void |
shutdownSelectors() |
void |
start()
Start clientConnectionManager
|
protected void |
startSelectors() |
protected final AtomicInteger connectionIdGen
protected volatile boolean alive
public ClientConnectionManagerImpl(HazelcastClientInstanceImpl client, AddressTranslator addressTranslator)
protected void initializeSelectors(HazelcastClientInstanceImpl client)
public boolean isAlive()
ClientConnectionManager
isAlive
in interface ClientConnectionManager
public void start()
ClientConnectionManager
start
in interface ClientConnectionManager
protected void startSelectors()
public void shutdown()
ClientConnectionManager
shutdown
in interface ClientConnectionManager
protected void shutdownSelectors()
public ClientConnection getConnection(Address target)
getConnection
in interface ClientConnectionManager
target
- to be connectedpublic Connection getOrConnect(Address address, boolean asOwner) throws IOException
getOrConnect
in interface ClientConnectionManager
address
- to be connectedasOwner
- true if connection should be authenticated as owner, false otherwiseIOException
- if connection is not establishedpublic Connection getOrTriggerConnect(Address target, boolean asOwner)
getOrTriggerConnect
in interface ClientConnectionManager
target
- to be connectedasOwner
- true if connection should be authenticated as owner, false otherwiseprotected ClientConnection createSocketConnection(Address address) throws IOException
IOException
public void destroyConnection(Connection connection, String reason, Throwable cause)
ClientConnectionManager
destroyConnection
in interface ClientConnectionManager
connection
- to be closedreason
- the reason of closing this exception. Can be null if no reason is given.cause
- exception that cause connection to be closed, null if closed explicitlypublic void handleClientMessage(ClientMessage message, Connection connection)
ClientConnectionManager
handleClientMessage
in interface ClientConnectionManager
message
- to be processedconnection
- that client message come frompublic void addConnectionListener(ConnectionListener connectionListener)
ConnectionListenable
addConnectionListener
in interface ConnectionListenable
connectionListener
- the ConnectionListener to add.public void addConnectionHeartbeatListener(ConnectionHeartbeatListener connectionHeartbeatListener)
addConnectionHeartbeatListener
in interface ClientConnectionManager
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.