Package org.elasticsearch.transport
Interface TcpChannel
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,CloseableChannel
public interface TcpChannel extends CloseableChannel
This is a tcp channel representing a single channel connection to another node. It is the base channel abstraction used by theTcpTransport
andTransportService
. All tcp transport implementations must return channels that adhere to the required method contracts.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addConnectListener(ActionListener<java.lang.Void> listener)
Adds a listener that will be executed when the channel is connected.java.net.InetSocketAddress
getLocalAddress()
Returns the local address for this channel.java.lang.String
getProfile()
This returns the profile for this channel.java.net.InetSocketAddress
getRemoteAddress()
Returns the remote address for this channel.void
sendMessage(BytesReference reference, ActionListener<java.lang.Void> listener)
Sends a tcp message to the channel.void
setSoLinger(int value)
This sets the low level socket optionStandardSocketOptions
SO_LINGER on a channel.-
Methods inherited from interface org.elasticsearch.common.network.CloseableChannel
addCloseListener, close, isOpen
-
-
-
-
Method Detail
-
getProfile
java.lang.String getProfile()
This returns the profile for this channel.
-
setSoLinger
void setSoLinger(int value) throws java.io.IOException
This sets the low level socket optionStandardSocketOptions
SO_LINGER on a channel.- Parameters:
value
- to set for SO_LINGER- Throws:
java.io.IOException
- that can be throw by the low level socket implementation
-
getLocalAddress
java.net.InetSocketAddress getLocalAddress()
Returns the local address for this channel.- Returns:
- the local address of this channel.
-
getRemoteAddress
java.net.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(BytesReference reference, ActionListener<java.lang.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
void addConnectListener(ActionListener<java.lang.Void> listener)
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
-
-