Package org.elasticsearch.transport
Class TcpTransport
java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.transport.TcpTransport
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- LifecycleComponent,- org.elasticsearch.core.Releasable,- Transport
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classA helper exception to mark an incoming connection as potentially being HTTP so an appropriate error code can be returnedclassstatic classRepresentation of a transport profile settings for atransport.profiles.$profilename.*Nested classes/interfaces inherited from interface org.elasticsearch.transport.TransportTransport.Connection, Transport.RequestHandlers, Transport.ResponseContext<T extends TransportResponse>, Transport.ResponseHandlers
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected NetworkServiceprotected PageCacheRecyclerprotected Set<TcpTransport.ProfileSettings>protected Settingsprotected ThreadPoolstatic StringFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponentlifecycle
- 
Constructor SummaryConstructorsConstructorDescriptionTcpTransport(Settings settings, Version version, ThreadPool threadPool, PageCacheRecycler pageCacheRecycler, CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService)
- 
Method SummaryModifier and TypeMethodDescriptionaddressesFromString(String address)Returns an address from its string representation.protected abstract TcpServerChannelbind(String name, InetSocketAddress address)Binds to the givenInetSocketAddressprotected voidbindServer(TcpTransport.ProfileSettings profileSettings)The address the transport is bound on.protected voiddoClose()protected voiddoStart()protected voiddoStop()voidexecuteHandshake(DiscoveryNode node, TcpChannel channel, ConnectionProfile profile, ActionListener<Version> listener)Returns a list of all local addresses for this transportstatic Set<TcpTransport.ProfileSettings>getProfileSettings(Settings settings)Returns all profile settings for the given settings objectgetStats()voidinboundMessage(TcpChannel channel, InboundMessage message)Handles inbound message that has been decoded.protected abstract TcpChannelinitiateChannel(DiscoveryNode node)Initiate a single tcp socket channel.protected ConnectionProfilemaybeOverrideConnectionProfile(ConnectionProfile connectionProfile)voidonException(TcpChannel channel, Exception e)protected voidonServerException(TcpServerChannel channel, Exception e)voidopenConnection(DiscoveryNode node, ConnectionProfile profile, ActionListener<Transport.Connection> listener)Opens a new connection to the given node.Further profile bound addressesstatic intreadMessageLength(BytesReference networkBytes)Validates the first 6 bytes of the message header and returns the length of the message.protected voidserverAcceptedChannel(TcpChannel channel)voidsetMessageListener(TransportMessageListener listener)voidsetSlowLogThreshold(org.elasticsearch.core.TimeValue slowLogThreshold)protected abstract voidCalled to tear down internal resourcesMethods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponentaddLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stopMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.common.component.LifecycleComponentaddLifecycleListener, lifecycleState, removeLifecycleListener, start, stopMethods inherited from interface org.elasticsearch.core.ReleasablecloseMethods inherited from interface org.elasticsearch.transport.TransportisSecure, registerRequestHandler
- 
Field Details- 
TRANSPORT_WORKER_THREAD_NAME_PREFIX- See Also:
- Constant Field Values
 
- 
settings
- 
threadPool
- 
pageCacheRecycler
- 
networkService
- 
profileSettings
 
- 
- 
Constructor Details- 
TcpTransportpublic TcpTransport(Settings settings, Version version, ThreadPool threadPool, PageCacheRecycler pageCacheRecycler, CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService)
 
- 
- 
Method Details- 
getVersion
- 
getStatsTracker
- 
getThreadPool
- 
getInflightBreaker
- 
doStartprotected void doStart()- Specified by:
- doStartin class- AbstractLifecycleComponent
 
- 
setMessageListener- Specified by:
- setMessageListenerin interface- Transport
 
- 
setSlowLogThresholdpublic void setSlowLogThreshold(org.elasticsearch.core.TimeValue slowLogThreshold)- Specified by:
- setSlowLogThresholdin interface- Transport
 
- 
maybeOverrideConnectionProfile
- 
openConnectionpublic void openConnection(DiscoveryNode node, ConnectionProfile profile, ActionListener<Transport.Connection> listener)Description copied from interface:TransportOpens a new connection to the given node. When the connection is fully connected, the listener is called. The ActionListener will be called on the calling thread or the generic thread pool.- Specified by:
- openConnectionin interface- Transport
 
- 
boundAddressDescription copied from interface:TransportThe address the transport is bound on.- Specified by:
- boundAddressin interface- Transport
 
- 
profileBoundAddressesDescription copied from interface:TransportFurther profile bound addresses- Specified by:
- profileBoundAddressesin interface- Transport
- Returns:
- nulliff profiles are unsupported, otherwise a map with name of profile and its bound transport address
 
- 
getDefaultSeedAddressesDescription copied from interface:TransportReturns a list of all local addresses for this transport- Specified by:
- getDefaultSeedAddressesin interface- Transport
 
- 
bindServer
- 
addressesFromStringDescription copied from interface:TransportReturns an address from its string representation.- Specified by:
- addressesFromStringin interface- Transport
- Throws:
- UnknownHostException
 
- 
doCloseprotected final void doClose()- Specified by:
- doClosein class- AbstractLifecycleComponent
 
- 
doStopprotected final void doStop()- Specified by:
- doStopin class- AbstractLifecycleComponent
 
- 
onException
- 
onServerException
- 
serverAcceptedChannel
- 
bindprotected abstract TcpServerChannel bind(String name, InetSocketAddress address) throws IOExceptionBinds to the givenInetSocketAddress- Parameters:
- name- the profile name
- address- the address to bind to
- Throws:
- IOException
 
- 
initiateChannelInitiate a single tcp socket channel.- Parameters:
- node- for the initiated connection
- Returns:
- the pending connection
- Throws:
- IOException- if an I/O exception occurs while opening the channel
 
- 
stopInternalprotected abstract void stopInternal()Called to tear down internal resources
- 
inboundMessageHandles inbound message that has been decoded.- Parameters:
- channel- the channel the message is from
- message- the message
 
- 
readMessageLengthValidates the first 6 bytes of the message header and returns the length of the message. If 6 bytes are not available, it returns -1.- Parameters:
- networkBytes- the will be read
- Returns:
- the length of the message
- Throws:
- StreamCorruptedException- if the message header format is not recognized
- TcpTransport.HttpRequestOnTransportException- if the message header appears to be an HTTP message
- IllegalArgumentException- if the message length is greater that the maximum allowed frame size. This is dependent on the available memory.
- IOException
 
- 
executeHandshakepublic void executeHandshake(DiscoveryNode node, TcpChannel channel, ConnectionProfile profile, ActionListener<Version> listener)
- 
getStats
- 
getProfileSettingsReturns all profile settings for the given settings object
- 
getResponseHandlers- Specified by:
- getResponseHandlersin interface- Transport
 
- 
getRequestHandlers- Specified by:
- getRequestHandlersin interface- Transport
 
 
-