Package org.elasticsearch.transport
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 Summary
Constructors Constructor Description Builder()
create an empty builderBuilder(ConnectionProfile source)
copy constructor, using another profile as a base -
Method Summary
Modifier and Type Method Description ConnectionProfile.Builder
addConnections(int numConnections, TransportRequestOptions.Type... types)
Adds a number of connections for one or more types.ConnectionProfile
build()
Creates a newConnectionProfile
based on the added connections.ConnectionProfile.Builder
setCompressionEnabled(boolean compressionEnabled)
Sets compression enabled for this connection profileConnectionProfile.Builder
setConnectTimeout(org.elasticsearch.common.unit.TimeValue connectTimeout)
Sets a connect timeout for this connection profileConnectionProfile.Builder
setHandshakeTimeout(org.elasticsearch.common.unit.TimeValue handshakeTimeout)
Sets a handshake timeout for this connection profileConnectionProfile.Builder
setPingInterval(org.elasticsearch.common.unit.TimeValue pingInterval)
Sets a ping interval for this connection profileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Builder
public Builder()create an empty builder -
Builder
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
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 typestypes
- a set of types that should share the given number of connections
-
build
Creates a newConnectionProfile
based on the added connections.- Throws:
java.lang.IllegalStateException
- if any of theTransportRequestOptions.Type
enum is missing
-