use of com.jim.framework.rpc.common.RpcResponse in project jim-framework by jiangmin168168.
the class AbstractHeartbeatHandler method sendPong.
protected void sendPong(ChannelHandlerContext channelHandlerContext) {
RpcMessage message = new RpcMessage();
String body = new Date().toString();
RpcResponse rpcResponse = new RpcResponse();
rpcResponse.setResult(body);
RpcMessageHeader messageHeader = new RpcMessageHeader();
messageHeader.setLength(body.length());
messageHeader.setType(Constants.MESSAGE_TYPE_HEARTBEAT_PONG);
message.setMessageHeader(messageHeader);
message.setMessageBody(rpcResponse);
channelHandlerContext.writeAndFlush(message);
}
use of com.jim.framework.rpc.common.RpcResponse in project jim-framework by jiangmin168168.
the class ResponseFuture method cancel.
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
if (!mayInterruptIfRunning) {
return false;
}
RpcResponse errorResult = new RpcResponse();
errorResult.setRequestId(this.request.getRequestId());
errorResult.setResult("request future has been canceled.");
response = errorResult;
this.isCancelledFlag = true;
return true;
}
Aggregations