Class ConnectionProfile.Builder

java.lang.Object
org.elasticsearch.transport.ConnectionProfile.Builder
Enclosing class:
ConnectionProfile

public static class ConnectionProfile.Builder
extends java.lang.Object
A builder to build a new ConnectionProfile
  • Constructor Details

    • Builder

      public Builder()
      create an empty builder
    • Builder

      public Builder​(ConnectionProfile source)
      copy constructor, using another profile as a base
  • Method Details

    • setConnectTimeout

      public ConnectionProfile.Builder setConnectTimeout​(org.elasticsearch.common.unit.TimeValue connectTimeout)
      Sets a connect timeout for this connection profile
    • setHandshakeTimeout

      public ConnectionProfile.Builder setHandshakeTimeout​(org.elasticsearch.common.unit.TimeValue handshakeTimeout)
      Sets a handshake timeout for this connection profile
    • setPingInterval

      public ConnectionProfile.Builder setPingInterval​(org.elasticsearch.common.unit.TimeValue pingInterval)
      Sets a ping interval for this connection profile
    • setCompressionEnabled

      public ConnectionProfile.Builder setCompressionEnabled​(boolean compressionEnabled)
      Sets compression enabled for this connection profile
    • addConnections

      public ConnectionProfile.Builder addConnections​(int numConnections, TransportRequestOptions.Type... types)
      Adds a number of connections for one or more types. Each type can only be added once.
      Parameters:
      numConnections - the number of connections to use in the pool for the given connection types
      types - a set of types that should share the given number of connections
    • build

      public ConnectionProfile build()
      Creates a new ConnectionProfile based on the added connections.
      Throws:
      java.lang.IllegalStateException - if any of the TransportRequestOptions.Type enum is missing