public class ClientConnectionManagerImpl extends Object implements 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) |
protected ClientConnection |
createSocketConnection(Address address) |
void |
destroyConnection(Connection connection)
Destroys the connection
Clears related resources of given connection.
|
ClientConnection |
getConnection(Address target) |
ClientConnection |
getOrConnect(Address target,
Authenticator authenticator) |
ClientConnection |
getOrTriggerConnect(Address target,
Authenticator authenticator) |
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 ClientConnection getOrConnect(Address target, Authenticator authenticator) throws IOException
getOrConnect
in interface ClientConnectionManager
target
- to be connectedauthenticator
- Authenticator implementation to send appropriate Authentication Request after connectionIOException
- if connection is not establishedpublic ClientConnection getOrTriggerConnect(Address target, Authenticator authenticator) throws IOException
getOrTriggerConnect
in interface ClientConnectionManager
target
- to be connectedauthenticator
- Authenticator implementation to send appropriate Authentication Request after connectionIOException
- if connection is not available at the time of callprotected ClientConnection createSocketConnection(Address address) throws IOException
IOException
public void destroyConnection(Connection connection)
ClientConnectionManager
destroyConnection
in interface ClientConnectionManager
connection
- to be closedpublic void handleClientMessage(ClientMessage message, Connection connection)
ClientConnectionManager
handleClientMessage
in interface ClientConnectionManager
message
- to be processedconnection
- that client message come frompublic void addConnectionListener(ConnectionListener connectionListener)
addConnectionListener
in interface ClientConnectionManager
public void addConnectionHeartbeatListener(ConnectionHeartbeatListener connectionHeartbeatListener)
addConnectionHeartbeatListener
in interface ClientConnectionManager
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.