Class SocketOptions.BuilderBase<BUILDER extends SocketOptions.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends SocketOptions>

java.lang.Object
io.helidon.common.socket.SocketOptions.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Api, Prototype.Builder<BUILDER,PROTOTYPE>, Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>, SocketOptions
Direct Known Subclasses:
SocketOptions.Builder
Enclosing interface:
SocketOptions

public abstract static class SocketOptions.BuilderBase<BUILDER extends SocketOptions.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends SocketOptions> extends Object implements Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>, SocketOptions
Fluent API builder base for SocketOptions.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(SocketOptions prototype)
      Update this builder from an existing prototype instance.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(SocketOptions.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and interceptors.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface Prototype.ConfiguredBuilder<BUILDER extends SocketOptions.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends SocketOptions>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • socketOptions

      public BUILDER socketOptions(Map<? extends SocketOption<?>,?> socketOptions)
      Arbitrary socket options. Socket options that have dedicated methods in this type will be ignored if configured within the map. This method replaces all values with the new ones.
      Parameters:
      socketOptions - custom socket options
      Returns:
      updated builder instance
      See Also:
    • addSocketOptions

      public BUILDER addSocketOptions(Map<? extends SocketOption<?>,?> socketOptions)
      Arbitrary socket options. Socket options that have dedicated methods in this type will be ignored if configured within the map. This method keeps existing values, then puts all new values into the map.
      Parameters:
      socketOptions - custom socket options
      Returns:
      updated builder instance
      See Also:
    • putSocketOption

      public <TYPE> BUILDER putSocketOption(SocketOption<TYPE> key, TYPE socketOption)
      Arbitrary socket options. Socket options that have dedicated methods in this type will be ignored if configured within the map. This method adds a new value to the map, or replaces it if the key already exists.
      Type Parameters:
      TYPE - Type to correctly map key and value
      Parameters:
      key - key to add or replace
      socketOption - new value for the key
      Returns:
      updated builder instance
      See Also:
    • connectTimeout

      public BUILDER connectTimeout(Duration connectTimeout)
      Socket connect timeout. Default is 10 seconds.
      Parameters:
      connectTimeout - connect timeout duration
      Returns:
      updated builder instance
      See Also:
    • readTimeout

      public BUILDER readTimeout(Duration readTimeout)
      Socket read timeout. Default is 30 seconds.
      Parameters:
      readTimeout - read timeout duration
      Returns:
      updated builder instance
      See Also:
    • socketReceiveBufferSize

      public BUILDER socketReceiveBufferSize(int socketReceiveBufferSize)
      Socket receive buffer size.
      Parameters:
      socketReceiveBufferSize - buffer size, in bytes
      Returns:
      updated builder instance
      See Also:
    • socketSendBufferSize

      public BUILDER socketSendBufferSize(int socketSendBufferSize)
      Socket send buffer size.
      Parameters:
      socketSendBufferSize - buffer size, in bytes
      Returns:
      updated builder instance
      See Also:
    • socketReuseAddress

      public BUILDER socketReuseAddress(boolean socketReuseAddress)
      Socket reuse address. Default is true.
      Parameters:
      socketReuseAddress - whether to reuse address
      Returns:
      updated builder instance
      See Also:
    • socketKeepAlive

      public BUILDER socketKeepAlive(boolean socketKeepAlive)
      Configure socket keep alive. Default is true.
      Parameters:
      socketKeepAlive - keep alive
      Returns:
      updated builder instance
      See Also:
    • tcpNoDelay

      public BUILDER tcpNoDelay(boolean tcpNoDelay)
      This option may improve performance on some systems. Default is false.
      Parameters:
      tcpNoDelay - whether to use TCP_NODELAY, defaults to false
      Returns:
      updated builder instance
      See Also:
    • socketOptions

      public Map<SocketOption<?>,Object> socketOptions()
      Arbitrary socket options. Socket options that have dedicated methods in this type will be ignored if configured within the map.
      Returns:
      the socket options
    • connectTimeout

      public Duration connectTimeout()
      Socket connect timeout. Default is 10 seconds.
      Returns:
      the connect timeout
    • readTimeout

      public Duration readTimeout()
      Socket read timeout. Default is 30 seconds.
      Returns:
      the read timeout
    • socketReceiveBufferSize

      public int socketReceiveBufferSize()
      Socket receive buffer size.
      Returns:
      the socket receive buffer size
    • socketSendBufferSize

      public int socketSendBufferSize()
      Socket send buffer size.
      Returns:
      the socket send buffer size
    • socketReuseAddress

      public boolean socketReuseAddress()
      Socket reuse address. Default is true.
      Returns:
      the socket reuse address
    • socketKeepAlive

      public boolean socketKeepAlive()
      Configure socket keep alive. Default is true.
      Returns:
      the socket keep alive
    • tcpNoDelay

      public boolean tcpNoDelay()
      This option may improve performance on some systems. Default is false.
      Returns:
      the tcp no delay
    • config

      public Optional<Config> config()
      If this instance was configured, this would be the config instance used.
      Returns:
      config node used to configure this builder, or empty if not configured
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • configureSocket

      default void configureSocket(Socket socket)
      Configure socket with defined socket options.
      Parameters:
      socket - socket to update