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.Builder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
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 ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
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. This method disables automatic service discovery.
      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
    • config

      @Deprecated 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 ConfigBuilderSupport.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
    • 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 ConfigBuilderSupport.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<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<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:
    • clearSocketReceiveBufferSize

      public BUILDER clearSocketReceiveBufferSize()
      Clear existing value of this property.
      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:
    • clearSocketSendBufferSize

      public BUILDER clearSocketSendBufferSize()
      Clear existing value of this property.
      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 Optional<Integer> socketReceiveBufferSize()
      Socket receive buffer size.
      Returns:
      the socket receive buffer size
      See Also:
    • socketSendBufferSize

      public Optional<Integer> socketSendBufferSize()
      Socket send buffer size.
      Returns:
      the socket send buffer size
      See Also:
    • socketReuseAddress

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

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

      public boolean tcpNoDelay()
      This option may improve performance on some systems. Default is false.
      Returns:
      the tcp no delay
      See Also:
    • 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
    • preBuildPrototype

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

      protected void validatePrototype()
      Validates required properties.