Package org.opensearch.transport
Interface TcpChannel
- All Superinterfaces:
AutoCloseable
,Closeable
,CloseableChannel
This is a tcp channel representing a single channel connection to another node. It is the base channel
abstraction used by the
TcpTransport
and TransportService
. All tcp transport
implementations must return channels that adhere to the required method contracts.- Opensearch.api:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addConnectListener
(org.opensearch.core.action.ActionListener<Void> listener) Adds a listener that will be executed when the channel is connected.default <T> Optional
<T> Returns the contextual property associated with this specific TCP channel (the implementation of how such properties are managed depends on the particular transport engine).Returns stats about this channelReturns the local address for this channel.This returns the profile for this channel.Returns the remote address for this channel.boolean
Indicates if the channel is an inbound server channel.void
sendMessage
(org.opensearch.core.common.bytes.BytesReference reference, org.opensearch.core.action.ActionListener<Void> listener) Sends a tcp message to the channel.Methods inherited from interface org.opensearch.common.network.CloseableChannel
addCloseListener, close, isOpen
-
Method Details
-
isServerChannel
boolean isServerChannel()Indicates if the channel is an inbound server channel. -
getProfile
String getProfile()This returns the profile for this channel. -
getLocalAddress
InetSocketAddress getLocalAddress()Returns the local address for this channel.- Returns:
- the local address of this channel.
-
getRemoteAddress
InetSocketAddress getRemoteAddress()Returns the remote address for this channel. Can be null if channel does not have a remote address.- Returns:
- the remote address of this channel.
-
sendMessage
void sendMessage(org.opensearch.core.common.bytes.BytesReference reference, org.opensearch.core.action.ActionListener<Void> listener) Sends a tcp message to the channel. The listener will be executed once the send process has been completed.- Parameters:
reference
- to send to channellistener
- to execute upon send completion
-
addConnectListener
Adds a listener that will be executed when the channel is connected. If the channel is still unconnected when this listener is added, the listener will be executed by the thread that eventually finishes the channel connection. If the channel is already connected when the listener is added the listener will immediately be executed by the thread that is attempting to add the listener.- Parameters:
listener
- to be executed
-
getChannelStats
TcpChannel.ChannelStats getChannelStats()Returns stats about this channel -
get
Returns the contextual property associated with this specific TCP channel (the implementation of how such properties are managed depends on the particular transport engine).- Parameters:
name
- the name of the propertyclazz
- the expected type of the property- Returns:
- the value of the property
-