com.hazelcast.client.connection

## Interface ClientConnectionManager

- All Superinterfaces:
    ConnectionListenable
  All Known Implementing Classes:
    ClientConnectionManagerImpl

      public interface ClientConnectionManager
      extends ConnectionListenable

  Responsible for managing `ClientConnection` objects.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beforeClusterSwitch(com.hazelcast.client.impl.clientside.CandidateClusterContext context)`
    `Connection` | `getActiveConnection(Address address)`
    `Collection<ClientConnection>` | `getActiveConnections()`
    `Connection` | `getOrConnect(Address address)`
    `Connection` | `getOrTriggerConnect(Address address, boolean acquiresResource)`
    `ClientConnection` | `getOwnerConnection()`
    `Address` | `getOwnerConnectionAddress()`
    `com.hazelcast.client.impl.client.ClientPrincipal` | `getPrincipal()`
    `boolean` | `isAlive()` Check if client connection manager is alive.
    `void` | `setCandidateClusterContext(com.hazelcast.client.impl.clientside.CandidateClusterContext context)`

    - ### Methods inherited from interface com.hazelcast.nio.ConnectionListenable

      `addConnectionListener`

- - ### Method Detail

    - #### 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.

    - #### getActiveConnection

          Connection getActiveConnection(Address address)

      Parameters:
        `address` - to be connected
      Returns:
        connection if available, null otherwise

    - #### getOrConnect

          Connection getOrConnect(Address address)
                           throws IOException

      Parameters:
        `address` - to be connected
      Returns:
        associated connection if available, creates new connection otherwise
      Throws:
        `IOException` - if connection is not established

    - #### getOrTriggerConnect

          Connection getOrTriggerConnect(Address address,
                                         boolean acquiresResource)
                                  throws IOException

      Parameters:
        `address` - to be connected
      Returns:
        associated connection if available, returns null and triggers new connection creation otherwise
      Throws:
        `IOException` - if connection is not able to triggered

    - #### getActiveConnections

          Collection<ClientConnection> getActiveConnections()

    - #### getOwnerConnectionAddress

          Address getOwnerConnectionAddress()

    - #### getPrincipal

          com.hazelcast.client.impl.client.ClientPrincipal getPrincipal()

    - #### getOwnerConnection

          ClientConnection getOwnerConnection()

    - #### setCandidateClusterContext

          void setCandidateClusterContext(com.hazelcast.client.impl.clientside.CandidateClusterContext context)

    - #### beforeClusterSwitch

          void beforeClusterSwitch(com.hazelcast.client.impl.clientside.CandidateClusterContext context)

Copyright © 2020. All rights reserved.