Interface SharedResources.Builder

Enclosing interface:
SharedResources

public static interface SharedResources.Builder
Builder for a SharedResources pool.
  • Method Details

    • numWorkerThreads

      SharedResources.Builder numWorkerThreads(int numWorkerThreads)
      Set the number of threads in the shared background thread pool.

      Default is the number of available processors.

      Parameters:
      numWorkerThreads - the number of worker threads
      Returns:
      the builder instance
    • batchingThreads

      SharedResources.Builder batchingThreads(int batchingThreads)
      Set the number of shared batch-assembly threads (reads and writes each get this many).

      These threads are shared by every client built on this pool, so the total number of batching threads stays fixed no matter how many clients are created. Default is 1.

      Parameters:
      batchingThreads - the number of shared batching threads
      Returns:
      the builder instance
    • enableTls

      SharedResources.Builder enableTls(boolean enableTls)
      Configure whether to enable TLS for the shared connections.

      Default is false.

      Parameters:
      enableTls - true to enable TLS
      Returns:
      the builder instance
    • authentication

      SharedResources.Builder authentication(Authentication authentication)
      Configure the authentication used by the shared connections.
      Parameters:
      authentication - the authentication instance
      Returns:
      the builder instance
    • connectionKeepAliveTime

      SharedResources.Builder connectionKeepAliveTime(Duration keepAliveTime)
      Configure the keep-alive interval for the shared connections.

      Default is 10 sec.

      Parameters:
      keepAliveTime - the keep-alive interval
      Returns:
      the builder instance
    • connectionKeepAliveTimeout

      SharedResources.Builder connectionKeepAliveTimeout(Duration keepAliveTimeout)
      Configure the keep-alive timeout for the shared connections.

      Default is 3 sec.

      Parameters:
      keepAliveTimeout - the keep-alive timeout
      Returns:
      the builder instance
    • connectionBackoff

      SharedResources.Builder connectionBackoff(Duration minDelay, Duration maxDelay)
      Configure the connection backoff policy for the shared connections.

      Defaults are min=100millis, max=30sec.

      Parameters:
      minDelay - the minimum delay between retries
      maxDelay - the maximum delay between retries
      Returns:
      the builder instance
    • maxConnectionPerNode

      SharedResources.Builder maxConnectionPerNode(int connections)
      Configure the maximum number of shared connections to each Oxia server node.

      Default is 1.

      Parameters:
      connections - the maximum number of connections
      Returns:
      the builder instance
    • openTelemetry

      SharedResources.Builder openTelemetry(OpenTelemetry openTelemetry)
      Configure the OpenTelemetry instance used for shared-resource metrics.

      By default, the global OpenTelemetry instance is used if available.

      Parameters:
      openTelemetry - an OpenTelemetry instance
      Returns:
      the builder instance
    • build

      Build the SharedResources pool.
      Returns:
      the shared resources instance