Package com.github.ambry.network
Interface RequestResponseChannel
-
public interface RequestResponseChannel
RequestResponse Channel used by the network layer to queue new requests and send responses over the network from the channel. This is used by the server and hence cannot be used to receive response or open a connection as they would be client related operations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
closeConnection(NetworkRequest request)
Closes the connection on which the original request cameNetworkRequest
receiveRequest()
Receives the request from the channelvoid
sendRequest(NetworkRequest request)
Sends a request over the network.void
sendResponse(Send payloadToSend, NetworkRequest originalRequest, ServerNetworkResponseMetrics metrics)
Queue's the response into the channel for the network server to pick upvoid
shutdown()
Shuts down the request response channel
-
-
-
Method Detail
-
sendResponse
void sendResponse(Send payloadToSend, NetworkRequest originalRequest, ServerNetworkResponseMetrics metrics) throws java.lang.InterruptedException
Queue's the response into the channel for the network server to pick up- Parameters:
payloadToSend
- The payload to be sent over the networkoriginalRequest
- The original request this response belongs tometrics
- The set of metrics tracked at the network layer- Throws:
java.lang.InterruptedException
-
receiveRequest
NetworkRequest receiveRequest() throws java.lang.InterruptedException
Receives the request from the channel- Returns:
- The request that was queued by the network layer into the channel
- Throws:
java.lang.InterruptedException
-
sendRequest
void sendRequest(NetworkRequest request) throws java.lang.InterruptedException
Sends a request over the network. The request gets queued by the channel.- Parameters:
request
- The request to be queued by the channel- Throws:
java.lang.InterruptedException
-
closeConnection
void closeConnection(NetworkRequest request) throws java.lang.InterruptedException
Closes the connection on which the original request came- Parameters:
request
- The request whose connection needs to be closed- Throws:
java.lang.InterruptedException
-
shutdown
void shutdown()
Shuts down the request response channel
-
-