Package com.github.ambry.network
Interface ConnectedChannel
-
public interface ConnectedChannel
A channel that is connected to a specific remote host and port. The connected channel can be used to send a request and receive a response. All connection management is done by the connection pool
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
connect()
Connect remote host.void
disconnect()
Disconnect remote host.java.lang.String
getRemoteHost()
Gets the remote host that this channel is connected toint
getRemotePort()
Gets the remote port that this channel is connected toChannelOutput
receive()
Receives a response from the remote hostvoid
send(Send request)
Sends the request to a remote hostdefault ChannelOutput
sendAndReceive(Send request)
Send a request and receive a response from the remote host
-
-
-
Method Detail
-
connect
void connect() throws java.io.IOException
Connect remote host.- Throws:
java.io.IOException
-
disconnect
void disconnect() throws java.io.IOException
Disconnect remote host.- Throws:
java.io.IOException
-
send
void send(Send request) throws java.io.IOException
Sends the request to a remote host- Parameters:
request
- The request that needs to be sent- Throws:
java.io.IOException
-
receive
ChannelOutput receive() throws java.io.IOException
Receives a response from the remote host- Returns:
- The input stream that can be used to consume data from the remote host
- Throws:
java.io.IOException
-
sendAndReceive
default ChannelOutput sendAndReceive(Send request) throws java.io.IOException
Send a request and receive a response from the remote host- Returns:
- The input stream that can be used to consume data from the remote host
- Throws:
java.io.IOException
-
getRemoteHost
java.lang.String getRemoteHost()
Gets the remote host that this channel is connected to- Returns:
- The remote host the channel is connected to
-
getRemotePort
int getRemotePort()
Gets the remote port that this channel is connected to- Returns:
- The remote port that this channel is connected to
-
-