Package org.elasticsearch.transport
Class ConnectionProfile
- java.lang.Object
-
- org.elasticsearch.transport.ConnectionProfile
-
public final class ConnectionProfile extends java.lang.ObjectA 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
Nested Classes Modifier and Type Class Description static classConnectionProfile.BuilderA builder to build a newConnectionProfile
-
Method Summary
Modifier and Type Method Description static ConnectionProfilebuildDefaultConnectionProfile(Settings settings)Builds a default connection profile based on the provided settings.static ConnectionProfilebuildSingleChannelProfile(TransportRequestOptions.Type channelType)Builds a connection profile that is dedicated to a single channel type.static ConnectionProfilebuildSingleChannelProfile(TransportRequestOptions.Type channelType, boolean compressionEnabled)Builds a connection profile that is dedicated to a single channel type.static ConnectionProfilebuildSingleChannelProfile(TransportRequestOptions.Type channelType, TimeValue connectTimeout, TimeValue handshakeTimeout)Builds a connection profile that is dedicated to a single channel type.static ConnectionProfilebuildSingleChannelProfile(TransportRequestOptions.Type channelType, TimeValue connectTimeout, TimeValue handshakeTimeout, TimeValue pingInterval, java.lang.Boolean compressionEnabled)Builds a connection profile that is dedicated to a single channel type.java.lang.BooleangetCompressionEnabled()Returns boolean indicating if compression is enabled ornullif no explicit compression is set on this profile.TimeValuegetConnectTimeout()Returns the connect timeout ornullif no explicit timeout is set on this profile.TimeValuegetHandshakeTimeout()Returns the handshake timeout ornullif no explicit timeout is set on this profile.intgetNumConnections()Returns the total number of connections for this profileintgetNumConnectionsPerType(TransportRequestOptions.Type type)Returns the number of connections per type for this profile.TimeValuegetPingInterval()Returns the ping interval ornullif no explicit ping interval is set on this profile.static ConnectionProfileresolveConnectionProfile(ConnectionProfile profile, ConnectionProfile fallbackProfile)takes aConnectionProfileresolves it to a fully specified (i.e., no nulls) profile
-
-
-
Method Detail
-
resolveConnectionProfile
public static ConnectionProfile resolveConnectionProfile(@Nullable ConnectionProfile profile, ConnectionProfile fallbackProfile)
takes aConnectionProfileresolves it to a fully specified (i.e., no nulls) profile
-
buildDefaultConnectionProfile
public static ConnectionProfile buildDefaultConnectionProfile(Settings settings)
Builds a default connection profile based on the provided settings.- Parameters:
settings- to build the connection profile from- Returns:
- the connection profile
-
buildSingleChannelProfile
public static ConnectionProfile buildSingleChannelProfile(TransportRequestOptions.Type channelType)
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, boolean compressionEnabled)
Builds a connection profile that is dedicated to a single channel type. Allows passing compression settings.
-
buildSingleChannelProfile
public static ConnectionProfile buildSingleChannelProfile(TransportRequestOptions.Type channelType, @Nullable TimeValue connectTimeout, @Nullable TimeValue handshakeTimeout)
Builds a connection profile that is dedicated to a single channel type. Allows passing connection and handshake timeouts.
-
buildSingleChannelProfile
public static ConnectionProfile buildSingleChannelProfile(TransportRequestOptions.Type channelType, @Nullable TimeValue connectTimeout, @Nullable TimeValue handshakeTimeout, @Nullable TimeValue pingInterval, @Nullable java.lang.Boolean compressionEnabled)
Builds a connection profile that is dedicated to a single channel type. Allows passing connection and handshake timeouts and compression settings.
-
getConnectTimeout
public TimeValue getConnectTimeout()
Returns the connect timeout ornullif no explicit timeout is set on this profile.
-
getHandshakeTimeout
public TimeValue getHandshakeTimeout()
Returns the handshake timeout ornullif no explicit timeout is set on this profile.
-
getPingInterval
public TimeValue getPingInterval()
Returns the ping interval ornullif no explicit ping interval is set on this profile.
-
getCompressionEnabled
public java.lang.Boolean getCompressionEnabled()
Returns boolean indicating if compression is enabled ornullif no explicit compression is set on this profile.
-
getNumConnections
public int getNumConnections()
Returns the total number of connections for this profile
-
getNumConnectionsPerType
public int getNumConnectionsPerType(TransportRequestOptions.Type type)
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.BULKshares connections withTransportRequestOptions.Type.REGthey will return both the same number of connections from this method but the connections are not distinct.
-
-