com.hazelcast.client.connection
Interface ClientConnectionManager

All Known Implementing Classes:
ClientConnectionManagerImpl

public interface ClientConnectionManager

Responsible for managing ClientConnection objects.


Method Summary
 ClientConnection connectToAddress(Address target)
           
 String getUuid()
           
 void handlePacket(Packet packet)
          Handles incoming network package
 boolean isAlive()
          Check if client connection manager is alive.
 int newCallId()
          Next unique call id for request
 void onCloseOwnerConnection()
          Called when an owner connection is closed
 void onConnectionClose(ClientConnection clientConnection)
          Called when an connection is closed.
 void onDetectingUnresponsiveConnection(ClientConnection connection)
          Called heartbeat timeout is detected on a connection.
 ClientConnection ownerConnection(Address address)
          Creates a new owner connection to given address
 void removeEndpoint(Address address)
          Called when a member left the cluster
 boolean removeEventHandler(Integer callId)
          Removes event handler corresponding to callId from responsible ClientConnection
 Object sendAndReceive(ClientRequest request, ClientConnection connection)
          Sends request and waits for response
 void shutdown()
          Shutdown clientConnectionManager
 void start()
          Start clientConnectionManager
 ClientConnection tryToConnect(Address address)
          Tries to connect to an address in member list.
 

Method Detail

shutdown

void shutdown()
Shutdown clientConnectionManager


isAlive

boolean isAlive()
Check if client connection manager is alive. ClientConnectionManager is not alive only when client is closing.

Returns:
true if alive, false otherwise.

start

void start()
Start clientConnectionManager


connectToAddress

ClientConnection connectToAddress(Address target)
                                  throws Exception
Throws:
Exception

tryToConnect

ClientConnection tryToConnect(Address address)
                              throws Exception
Tries to connect to an address in member list. Gets an address a hint first tries that if not successful, tries connections from LoadBalancer

Parameters:
address - hintAddress
Returns:
authenticated connection
Throws:
Exception - authentication failed or no connection found

ownerConnection

ClientConnection ownerConnection(Address address)
                                 throws IOException
Creates a new owner connection to given address

Parameters:
address - to be connection to established
Returns:
ownerConnection
Throws:
IOException

onCloseOwnerConnection

void onCloseOwnerConnection()
Called when an owner connection is closed


getUuid

String getUuid()
Returns:
unique uuid of local client if available, null otherwise

onConnectionClose

void onConnectionClose(ClientConnection clientConnection)
Called when an connection is closed. Clears related resources of given clientConnection.

Parameters:
clientConnection - closed connection

removeEndpoint

void removeEndpoint(Address address)
Called when a member left the cluster

Parameters:
address - address of the member

removeEventHandler

boolean removeEventHandler(Integer callId)
Removes event handler corresponding to callId from responsible ClientConnection

Parameters:
callId - of event handler registration request
Returns:
true if found and removed, false otherwise

handlePacket

void handlePacket(Packet packet)
Handles incoming network package

Parameters:
packet - to be processed

newCallId

int newCallId()
Next unique call id for request

Returns:
new unique callId

sendAndReceive

Object sendAndReceive(ClientRequest request,
                      ClientConnection connection)
                      throws Exception
Sends request and waits for response

Parameters:
request - to be send
connection - to send the request over
Returns:
response of request
Throws:
Exception - if a network connection occurs or response is an exception

onDetectingUnresponsiveConnection

void onDetectingUnresponsiveConnection(ClientConnection connection)
Called heartbeat timeout is detected on a connection.

Parameters:
connection - to be marked.


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.