use of com.baidu.hugegraph.computer.core.network.message.AckMessage in project hugegraph-computer by hugegraph.
the class NettyServerHandler method ackStartMessage.
private void ackStartMessage(ChannelHandlerContext ctx) {
AckMessage startAck = new AckMessage(AbstractMessage.START_SEQ);
ctx.writeAndFlush(startAck).addListener(this.listenerOnWrite);
this.serverSession.completeStateStart();
Channel channel = ctx.channel();
this.handler.onStarted(TransportUtil.remoteConnectionId(channel));
// Add an schedule task to check and respond ack
if (this.respondAckTask == null) {
EventLoop eventExecutors = ctx.channel().eventLoop();
this.respondAckTask = eventExecutors.scheduleWithFixedDelay(() -> this.checkAndRespondAck(ctx), INITIAL_DELAY, this.serverSession.minAckInterval(), TimeUnit.MILLISECONDS);
}
}
use of com.baidu.hugegraph.computer.core.network.message.AckMessage in project hugegraph-computer by hugegraph.
the class NettyServerHandler method ackFinishMessage.
private void ackFinishMessage(ChannelHandlerContext ctx, int finishId) {
AckMessage finishAck = new AckMessage(finishId);
ctx.writeAndFlush(finishAck).addListener(this.listenerOnWrite);
this.serverSession.completeStateFinish();
Channel channel = ctx.channel();
this.handler.onFinished(TransportUtil.remoteConnectionId(channel));
// Cancel and remove the task to check respond ack
if (this.respondAckTask != null) {
this.respondAckTask.cancel(false);
this.respondAckTask = null;
}
}
use of com.baidu.hugegraph.computer.core.network.message.AckMessage in project hugegraph-computer by hugegraph.
the class NettyServerHandler method ackDataMessage.
private void ackDataMessage(ChannelHandlerContext ctx, int ackId) {
AckMessage ackMessage = new AckMessage(ackId);
ctx.writeAndFlush(ackMessage).addListener(this.listenerOnWrite);
this.serverSession.onDataAckSent(ackId);
}
Aggregations