Interface ClientConnectionManager

  • All Superinterfaces:
    com.google.common.util.concurrent.Service
    All Known Implementing Classes:
    BlockingClientManager, NioClientManager

    public interface ClientConnectionManager
    extends com.google.common.util.concurrent.Service

    A generic interface for an object which keeps track of a set of open client connections, creates new ones and ensures they are serviced properly.

    When the service is stopped via Service.stopAsync(), all connections will be closed and the appropriate connectionClosed() calls must be made.

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service

        com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void closeConnections​(int n)
      Closes n peer connections
      int getConnectedClientCount()
      Gets the number of connected peers
      ListenableCompletableFuture<java.net.SocketAddress> openConnection​(java.net.SocketAddress serverAddress, StreamConnection connection)
      Creates a new connection to the given address, with the given connection used to handle incoming data.
      • Methods inherited from interface com.google.common.util.concurrent.Service

        addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
    • Method Detail

      • openConnection

        ListenableCompletableFuture<java.net.SocketAddress> openConnection​(java.net.SocketAddress serverAddress,
                                                                           StreamConnection connection)
        Creates a new connection to the given address, with the given connection used to handle incoming data. Any errors that occur during connection will be returned in the given future, including errors that can occur immediately.
      • getConnectedClientCount

        int getConnectedClientCount()
        Gets the number of connected peers
      • closeConnections

        void closeConnections​(int n)
        Closes n peer connections