Class ConnectionDegradation.Builder

    • Constructor Detail

      • Builder

        public Builder()
        Creates a new builder without configured defaults.
    • Method Detail

      • registerDefaultConnectionType

        public <T extends ISocketConnectionDegradation.Builder registerDefaultConnectionType​(Class<T> socketType,
                                                                                               Supplier<T> supplier)
        Registers a new supported connection type. This type will be used first to connect with peers. When the connection fails there will be no further attempts to connect. This will override any previously configured default socket types.
        Type Parameters:
        T - The type of the socket
        Parameters:
        socketType - The type of the socket.
        supplier - The Supplier method which creates new unconnected socket instances
        Returns:
        The builder with updated configuration.
        See Also:
        registerDefaultConnectionType(Class, Supplier, Class)
      • registerDefaultConnectionType

        public <T extends ISocketConnectionDegradation.Builder registerDefaultConnectionType​(Class<T> socketType,
                                                                                               Supplier<T> supplier,
                                                                                               Class<? extends ISocket> fallbackType)
        Registers a new supported connection type. This type will be used first to connect with peers. The given fallback will be the used to connect when this type fails to connect to the peer. This will override any previously configured default socket types.
        Type Parameters:
        T - The type of the socket
        Parameters:
        socketType - The type of the socket.
        supplier - The Supplier method which creates new unconnected socket instances
        fallbackType - The socket type to use when socketType connection fails.
        Returns:
        The builder with updated configuration.
        See Also:
        registerConnectionType(Class, Supplier, Class)
      • registerConnectionType

        public <T extends ISocketConnectionDegradation.Builder registerConnectionType​(Class<T> socketType,
                                                                                        Supplier<T> supplier)
        Registers a new supported connection type. When the connection fails there will be no further attempts to connect. socket types.
        Type Parameters:
        T - The type of the socket
        Parameters:
        socketType - The type of the socket.
        supplier - The Supplier method which creates new unconnected socket instances
        Returns:
        The builder with updated configuration.
        See Also:
        registerDefaultConnectionType(Class, Supplier)
      • registerConnectionType

        public <T extends ISocketConnectionDegradation.Builder registerConnectionType​(Class<T> socketType,
                                                                                        Supplier<T> supplier,
                                                                                        Class<? extends ISocket> fallbackType)
        Registers a new supported connection type. The given fallback will be the used to connect when this type fails to connect to the peer. This will override any previously configured default socket types.
        Type Parameters:
        T - The type of the socket
        Parameters:
        socketType - The type of the socket.
        supplier - The Supplier method which creates new unconnected socket instances
        fallbackType - The socket type to use when socketType connection fails.
        Returns:
        The builder with updated configuration.
        See Also:
        registerDefaultConnectionType(Class, Supplier, Class)