use of com.alibaba.dubbo.remoting.exchange.Response in project dubbo by alibaba.
the class HeartBeatExchangeHandler method received.
@Override
public void received(Channel channel, Object message) throws RemotingException {
if (message instanceof Request) {
Request req = (Request) message;
if (req.isHeartbeat()) {
heartBeatCounter.incrementAndGet();
channel.setAttribute(KEY_READ_TIMESTAMP, System.currentTimeMillis());
Response res = new Response(req.getId(), req.getVersion());
res.setEvent(req.getData() == null ? null : req.getData().toString());
channel.send(res);
}
} else {
super.received(channel, message);
}
}
Aggregations