com.hazelcast.nio.tcp

## Class TcpIpEndpointManager

- java.lang.Object
- - com.hazelcast.nio.tcp.TcpIpEndpointManager

- All Implemented Interfaces:
    ConnectionListenable, EndpointManager<TcpIpConnection>, Consumer<Packet>

      public class TcpIpEndpointManager
      extends Object
      implements EndpointManager<TcpIpConnection>, Consumer<Packet>

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `TcpIpEndpointManager.EndpointConnectionLifecycleListener`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `accept(Packet packet)` Performs this operation on the given argument.
    `void` | `addConnectionListener(ConnectionListener listener)` Registers a ConnectionListener.
    `Collection<TcpIpConnection>` | `getActiveConnections()` Returns all connections bind or not that are currently holding resources on this member.
    `TcpIpConnection` | `getConnection(Address address)` Gets the connection for a given address.
    `Collection<TcpIpConnection>` | `getConnections()` Returns connections that have been successfully established (ie.
    `EndpointQualifier` | `getEndpointQualifier()`
    `NetworkingService` | `getNetworkingService()`
    `TcpIpConnection` | `getOrConnect(Address address)` Gets the existing connection for a given address or connects.
    `TcpIpConnection` | `getOrConnect(Address address, boolean silent)` Gets the existing connection for a given address.
    `boolean` | `registerConnection(Address remoteEndPoint, TcpIpConnection connection)` Registers (ie.
    `void` | `reset(boolean cleanListeners)`
    `String` | `toString()`
    `boolean` | `transmit(Packet packet, Address target)` Transmits a packet to a certain address.
    `boolean` | `transmit(Packet packet, TcpIpConnection connection)` Transmits a packet to a certain connection.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getNetworkingService

          public NetworkingService getNetworkingService()

    - #### getEndpointQualifier

          public EndpointQualifier getEndpointQualifier()

    - #### getActiveConnections

          public Collection<TcpIpConnection> getActiveConnections()

      Description copied from interface: `EndpointManager`
      Returns all connections bind or not that are currently holding resources on this member. If the connection never successfully finishes with the handshake then it will only be visible through this sub-set.
      Specified by:
        `getActiveConnections` in interface `EndpointManager<TcpIpConnection>`
      Returns:
        Collection of all connections hold on this member

    - #### getConnections

          public Collection<TcpIpConnection> getConnections()

      Description copied from interface: `EndpointManager`
      Returns connections that have been successfully established (ie. Bind was completed)
      Specified by:
        `getConnections` in interface `EndpointManager<TcpIpConnection>`

    - #### addConnectionListener

          public void addConnectionListener(ConnectionListener listener)

      Description copied from interface: `ConnectionListenable`
      Registers a ConnectionListener. If the same listener is registered multiple times, it will be notified multiple times.
      Specified by:
        `addConnectionListener` in interface `ConnectionListenable`
      Parameters:
        `listener` - the ConnectionListener to add.

    - #### accept

          public void accept(Packet packet)

      Description copied from interface: `Consumer`
      Performs this operation on the given argument.
      Specified by:
        `accept` in interface `Consumer<Packet>`
      Parameters:
        `packet` - the input argument

    - #### getConnection

          public TcpIpConnection getConnection(Address address)

      Description copied from interface: `EndpointManager`
      Gets the connection for a given address. If the connection does not exist, it returns null.
      Specified by:
        `getConnection` in interface `EndpointManager<TcpIpConnection>`
      Parameters:
        `address` - the remote side of the connection
      Returns:
        the found Connection, or none if one doesn't exist

    - #### getOrConnect

          public TcpIpConnection getOrConnect(Address address)

      Description copied from interface: `EndpointManager`
      Gets the existing connection for a given address or connects. This call is silent.
      Specified by:
        `getOrConnect` in interface `EndpointManager<TcpIpConnection>`
      Parameters:
        `address` - the address to connect to
      Returns:
        the found connection, or `null` if no connection exists
      See Also:
        `EndpointManager.getOrConnect(Address, boolean)`

    - #### getOrConnect

          public TcpIpConnection getOrConnect(Address address,
                                              boolean silent)

      Description copied from interface: `EndpointManager`
      Gets the existing connection for a given address. If it does not exist, the system will try to connect asynchronously. In this case, it returns `null`.

      When the connection is established at some point in time, it can be retrieved using the `EndpointManager.getConnection(Address)`.

      Specified by:
        `getOrConnect` in interface `EndpointManager<TcpIpConnection>`
      Parameters:
        `address` - the address to connect to
        `silent` - if logging should be done on debug level (`silent=true`) or on info level (`silent=false`)
      Returns:
        the existing connection

    - #### registerConnection

          public boolean registerConnection(Address remoteEndPoint,
                                            TcpIpConnection connection)

      Description copied from interface: `EndpointManager`
      Registers (ie. stores) the connection for the given remote address. Once this call finishes every subsequent call to `EndpointManager.getConnection(Address)` will return the relevant `Connection` resource.
      Specified by:
        `registerConnection` in interface `EndpointManager<TcpIpConnection>`
      Parameters:
        `remoteEndPoint` - - The remote endpoint to register the connection under
        `connection` - - The connection to be registered
      Returns:
        True if the call was successful

    - #### reset

          public void reset(boolean cleanListeners)

    - #### transmit

          public boolean transmit(Packet packet,
                                  TcpIpConnection connection)

      Description copied from interface: `EndpointManager`
      Transmits a packet to a certain connection.

      If this method is called with a `null` connection, the call returns `false`.

      Specified by:
        `transmit` in interface `EndpointManager<TcpIpConnection>`
      Parameters:
        `packet` - the packet to transmit
        `connection` - he connection to where the Packet should be transmitted
      Returns:
        `true` 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)

    - #### transmit

          public boolean transmit(Packet packet,
                                  Address target)

      Description copied from interface: `EndpointManager`
      Transmits a packet to a certain address.

      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.

      Specified by:
        `transmit` in interface `EndpointManager<TcpIpConnection>`
      Parameters:
        `packet` - The Packet to transmit.
        `target` - The address of the target machine where the Packet should be transmitted.
      Returns:
        true if the transmit was a success, false if a failure.
      See Also:
        `EndpointManager.transmit(com.hazelcast.nio.Packet, com.hazelcast.nio.Connection)`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2020. All rights reserved.