Package org.elasticsearch.transport
Class ConnectionProfile
- java.lang.Object
-
- org.elasticsearch.transport.ConnectionProfile
-
public final class ConnectionProfile extends java.lang.Object
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
Nested Classes Modifier and Type Class Description static class
ConnectionProfile.Builder
A builder to build a newConnectionProfile
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ConnectionProfile
buildDefaultConnectionProfile(Settings settings)
Builds a default connection profile based on the provided settings.static ConnectionProfile
buildSingleChannelProfile(TransportRequestOptions.Type channelType, TimeValue connectTimeout, TimeValue handshakeTimeout)
Builds a connection profile that is dedicated to a single channel type.TimeValue
getConnectTimeout()
Returns the connect timeout ornull
if no explicit timeout is set on this profile.TimeValue
getHandshakeTimeout()
Returns the handshake timeout ornull
if no explicit timeout is set on this profile.int
getNumConnections()
Returns the total number of connections for this profileint
getNumConnectionsPerType(TransportRequestOptions.Type type)
Returns the number of connections per type for this profile.static ConnectionProfile
resolveConnectionProfile(ConnectionProfile profile, ConnectionProfile fallbackProfile)
takes aConnectionProfile
resolves it to a fully specified (i.e., no nulls) profile
-
-
-
Method Detail
-
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. Use this when opening single use connections
-
resolveConnectionProfile
public static ConnectionProfile resolveConnectionProfile(@Nullable ConnectionProfile profile, ConnectionProfile fallbackProfile)
takes aConnectionProfile
resolves 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
-
getConnectTimeout
public TimeValue getConnectTimeout()
Returns the connect timeout ornull
if no explicit timeout is set on this profile.
-
getHandshakeTimeout
public TimeValue getHandshakeTimeout()
Returns the handshake timeout ornull
if no explicit timeout 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.BULK
shares connections withTransportRequestOptions.Type.REG
they will return both the same number of connections from this method but the connections are not distinct.
-
-