class RpcHeartBeatProcessor extends AbstractRemotingProcessor {
    private static final Logger logger = BoltLoggerFactory.getLogger("RpcRemoting");

    @Override
    public void doProcess(final RemotingContext ctx, RemotingCommand msg) {<FILL_FUNCTION_BODY>}

}

        if (msg instanceof HeartbeatCommand) {// process the heartbeat
            final int id = msg.getId();
            if (logger.isDebugEnabled()) {
                logger.debug("Heartbeat received! Id=" + id + ", from "
                             + RemotingUtil.parseRemoteAddress(ctx.getChannelContext().channel()));
            }
            HeartbeatAckCommand ack = new HeartbeatAckCommand();
            ack.setId(id);
            ctx.writeAndFlush(ack).addListener(new ChannelFutureListener() {

                @Override
                public void operationComplete(ChannelFuture future) throws Exception {
                    if (future.isSuccess()) {
                        if (logger.isDebugEnabled()) {
                            logger.debug("Send heartbeat ack done! Id={}, to remoteAddr={}", id,
                                RemotingUtil.parseRemoteAddress(ctx.getChannelContext().channel()));
                        }
                    } else {
                        logger.error("Send heartbeat ack failed! Id={}, to remoteAddr={}", id,
                            RemotingUtil.parseRemoteAddress(ctx.getChannelContext().channel()));
                    }
                }

            });
        } else if (msg instanceof HeartbeatAckCommand) {
            Connection conn = ctx.getChannelContext().channel().attr(Connection.CONNECTION).get();
            InvokeFuture future = conn.removeInvokeFuture(msg.getId());
            if (future != null) {
                future.putResponse(msg);
                future.cancelTimeout();
                try {
                    future.executeInvokeCallback();
                } catch (Exception e) {
                    logger.error(
                        "Exception caught when executing heartbeat invoke callback. From {}",
                        RemotingUtil.parseRemoteAddress(ctx.getChannelContext().channel()), e);
                }
            } else {
                logger
                    .warn(
                        "Cannot find heartbeat InvokeFuture, maybe already timeout. Id={}, From {}",
                        msg.getId(),
                        RemotingUtil.parseRemoteAddress(ctx.getChannelContext().channel()));
            }
        } else {
            throw new RuntimeException("Cannot process command: " + msg.getClass().getName());
        }
    
<methods>public void <init>() ,public void <init>(com.alipay.remoting.CommandFactory) ,public void <init>(java.util.concurrent.ExecutorService) ,public void <init>(com.alipay.remoting.CommandFactory, java.util.concurrent.ExecutorService) ,public abstract void doProcess(com.alipay.remoting.RemotingContext, com.alipay.remoting.RemotingCommand) throws java.lang.Exception,public com.alipay.remoting.CommandFactory getCommandFactory() ,public java.util.concurrent.ExecutorService getExecutor() ,public void process(com.alipay.remoting.RemotingContext, com.alipay.remoting.RemotingCommand, java.util.concurrent.ExecutorService) throws java.lang.Exception,public void setCommandFactory(com.alipay.remoting.CommandFactory) ,public void setExecutor(java.util.concurrent.ExecutorService) <variables>private com.alipay.remoting.CommandFactory commandFactory,private java.util.concurrent.ExecutorService executor,private static final Logger logger