Package com.github.ambry.network
Class ResponseInfo
- java.lang.Object
-
- com.github.ambry.utils.AbstractByteBufHolder<ResponseInfo>
-
- com.github.ambry.network.ResponseInfo
-
- All Implemented Interfaces:
io.netty.buffer.ByteBufHolder
,io.netty.util.ReferenceCounted
public class ResponseInfo extends com.github.ambry.utils.AbstractByteBufHolder<ResponseInfo>
The response from aNetworkClient
comes in the form of an object of this class. This class consists of the request associated with this response, along with either a non-null exception if there was an error sending the request or a non-null ByteBuffer containing the successful response received for this request. Also, this class containsDataNodeId
to which the request is issued.
-
-
Constructor Summary
Constructors Constructor Description ResponseInfo(RequestInfo requestInfo, NetworkClientErrorCode error, io.netty.buffer.ByteBuf content)
Constructs a ResponseInfo with the given parameters.ResponseInfo(RequestInfo requestInfo, NetworkClientErrorCode error, io.netty.buffer.ByteBuf content, DataNodeId dataNode)
Constructs a ResponseInfo with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.netty.buffer.ByteBuf
content()
DataNodeId
getDataNode()
NetworkClientErrorCode
getError()
RequestInfo
getRequestInfo()
ResponseInfo
replace(io.netty.buffer.ByteBuf content)
java.lang.String
toString()
-
-
-
Constructor Detail
-
ResponseInfo
public ResponseInfo(RequestInfo requestInfo, NetworkClientErrorCode error, io.netty.buffer.ByteBuf content)
Constructs a ResponseInfo with the given parameters.- Parameters:
requestInfo
- theRequestInfo
associated with this response.error
- the error encountered in sending this request, if there is any.content
- the response received for this request.
-
ResponseInfo
public ResponseInfo(RequestInfo requestInfo, NetworkClientErrorCode error, io.netty.buffer.ByteBuf content, DataNodeId dataNode)
Constructs a ResponseInfo with the given parameters.- Parameters:
requestInfo
- theRequestInfo
associated with this response.error
- the error encountered in sending this request, if there is any.content
- the response received for this request.dataNode
- theDataNodeId
of this request.
-
-
Method Detail
-
getRequestInfo
public RequestInfo getRequestInfo()
- Returns:
- the
RequestInfo
associated with this response.
-
getError
public NetworkClientErrorCode getError()
- Returns:
- the error encountered in sending this request.
-
getDataNode
public DataNodeId getDataNode()
- Returns:
- the
DataNodeId
with which the response is associated.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
content
public io.netty.buffer.ByteBuf content()
- Specified by:
content
in interfaceio.netty.buffer.ByteBufHolder
- Specified by:
content
in classcom.github.ambry.utils.AbstractByteBufHolder<ResponseInfo>
-
replace
public ResponseInfo replace(io.netty.buffer.ByteBuf content)
- Specified by:
replace
in interfaceio.netty.buffer.ByteBufHolder
- Specified by:
replace
in classcom.github.ambry.utils.AbstractByteBufHolder<ResponseInfo>
-
-