Package org.elasticsearch.transport
Class ConnectionProfile
java.lang.Object
org.elasticsearch.transport.ConnectionProfile
A connection profile describes how many connection are established to specific node for each of the available request types.
(
TransportRequestOptions.Type
). This allows to tailor a connection towards a specific usage.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConnectionProfile
buildDefaultConnectionProfile(Settings settings)
Builds a default connection profile based on the provided settings.static ConnectionProfile
buildSingleChannelProfile(TransportRequestOptions.Type channelType)
Builds a connection profile that is dedicated to a single channel type.static ConnectionProfile
buildSingleChannelProfile(TransportRequestOptions.Type channelType, org.elasticsearch.core.TimeValue connectTimeout, org.elasticsearch.core.TimeValue handshakeTimeout, org.elasticsearch.core.TimeValue pingInterval, Compression.Enabled compressionEnabled, Compression.Scheme compressionScheme)
Builds a connection profile that is dedicated to a single channel type.Returns the compression enabled configuration ornull
if no explicit compression configuration is set on this profile.Returns the configured compression scheme ornull
if no explicit compression scheme is set on this profile.org.elasticsearch.core.TimeValue
Returns the connect timeout ornull
if no explicit timeout is set on this profile.org.elasticsearch.core.TimeValue
Returns the handshake timeout ornull
if no explicit timeout is set on this profile.int
Returns the total number of connections for this profileint
Returns the number of connections per type for this profile.org.elasticsearch.core.TimeValue
Returns the ping interval ornull
if no explicit ping interval is set on this profile.static ConnectionProfile
resolveConnectionProfile(ConnectionProfile profile, ConnectionProfile fallbackProfile)
takes aConnectionProfile
resolves it to a fully specified (i.e., no nulls) profile
-
Method Details
-
resolveConnectionProfile
public static ConnectionProfile resolveConnectionProfile(@Nullable ConnectionProfile profile, ConnectionProfile fallbackProfile)takes aConnectionProfile
resolves it to a fully specified (i.e., no nulls) profile -
buildDefaultConnectionProfile
Builds a default connection profile based on the provided settings.- Parameters:
settings
- to build the connection profile from- Returns:
- the connection profile
-
buildSingleChannelProfile
Builds a connection profile that is dedicated to a single channel type. Use this when opening single use connections -
buildSingleChannelProfile
public static ConnectionProfile buildSingleChannelProfile(TransportRequestOptions.Type channelType, @Nullable org.elasticsearch.core.TimeValue connectTimeout, @Nullable org.elasticsearch.core.TimeValue handshakeTimeout, @Nullable org.elasticsearch.core.TimeValue pingInterval, @Nullable Compression.Enabled compressionEnabled, @Nullable Compression.Scheme compressionScheme)Builds a connection profile that is dedicated to a single channel type. Allows passing connection and handshake timeouts and compression settings. -
getConnectTimeout
public org.elasticsearch.core.TimeValue getConnectTimeout()Returns the connect timeout ornull
if no explicit timeout is set on this profile. -
getHandshakeTimeout
public org.elasticsearch.core.TimeValue getHandshakeTimeout()Returns the handshake timeout ornull
if no explicit timeout is set on this profile. -
getPingInterval
public org.elasticsearch.core.TimeValue getPingInterval()Returns the ping interval ornull
if no explicit ping interval is set on this profile. -
getCompressionEnabled
Returns the compression enabled configuration ornull
if no explicit compression configuration is set on this profile. -
getCompressionScheme
Returns the configured compression scheme ornull
if no explicit compression scheme is set on this profile. -
getNumConnections
public int getNumConnections()Returns the total number of connections for this profile -
getNumConnectionsPerType
Returns the number of connections per type for this profile. This might return a count that is shared with other types such that the sum of all connections per type might be higher thangetNumConnections()
. For instance ifTransportRequestOptions.Type.BULK
shares connections withTransportRequestOptions.Type.REG
they will return both the same number of connections from this method but the connections are not distinct.
-