Class ConnectParam.Builder

  • Enclosing class:
    ConnectParam

    public static class ConnectParam.Builder
    extends java.lang.Object
    Builder for ConnectParam
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • withHost

        public ConnectParam.Builder withHost​(@Nonnull
                                             java.lang.String host)
        Optional. Defaults to "localhost".
        Parameters:
        host - server host
        Returns:
        Builder
      • withPort

        public ConnectParam.Builder withPort​(int port)
                                      throws java.lang.IllegalArgumentException
        Optional. Defaults to "19530".
        Parameters:
        port - server port
        Returns:
        Builder
        Throws:
        java.lang.IllegalArgumentException
      • withConnectTimeout

        public ConnectParam.Builder withConnectTimeout​(long connectTimeout,
                                                       @Nonnull
                                                       java.util.concurrent.TimeUnit timeUnit)
                                                throws java.lang.IllegalArgumentException
        Optional. Defaults to 10 seconds.
        Parameters:
        connectTimeout - Timeout for client to establish a connection to server
        Returns:
        Builder
        Throws:
        java.lang.IllegalArgumentException
      • withKeepAliveTime

        public ConnectParam.Builder withKeepAliveTime​(long keepAliveTime,
                                                      @Nonnull
                                                      java.util.concurrent.TimeUnit timeUnit)
                                               throws java.lang.IllegalArgumentException
        Optional. Sets the time without read activity before sending a keepalive ping. An unreasonably small value might be increased, and Long.MAX_VALUE nano seconds or an unreasonably large value will disable keepalive. Defaults to infinite.
        Returns:
        Builder
        Throws:
        java.lang.IllegalArgumentException
        See Also:
        GRPC keepAliveTime Javadoc
      • withKeepAliveTimeout

        public ConnectParam.Builder withKeepAliveTimeout​(long keepAliveTimeout,
                                                         @Nonnull
                                                         java.util.concurrent.TimeUnit timeUnit)
                                                  throws java.lang.IllegalArgumentException
        Optional. Sets the time waiting for read activity after sending a keepalive ping. If the time expires without any read activity on the connection, the connection is considered dead. An unreasonably small value might be increased. Defaults to 20 seconds.

        This value should be at least multiple times the RTT to allow for lost packets.

        Returns:
        Builder
        Throws:
        java.lang.IllegalArgumentException
        See Also:
        GRPC keepAliveTimeout Javadoc
      • keepAliveWithoutCalls

        public ConnectParam.Builder keepAliveWithoutCalls​(boolean enable)
        Optional. Sets whether keepalive will be performed when there are no outstanding RPC on a connection. Defaults to false.
        Returns:
        Builder
        See Also:
        GRPC keepAliveWithoutCalls Javadoc
      • withIdleTimeout

        public ConnectParam.Builder withIdleTimeout​(long idleTimeout,
                                                    java.util.concurrent.TimeUnit timeUnit)
                                             throws java.lang.IllegalArgumentException
        Optional. Set the duration without ongoing RPCs before going to idle mode. A new RPC would take the channel out of idle mode. Defaults to 24 hour.
        Returns:
        Builder
        Throws:
        java.lang.IllegalArgumentException
        See Also:
        GRPC idleTimeout Javadoc