Netty 中也可以进行任务调度。
1.60秒后调用一次
Channel channel = new LocalChannel();
channel.eventLoop().schedule(() -> {
System.out.println("60s!");
}, 60, TimeUnit.SECONDS);
2.每隔60秒调用一次
ScheduledFuture sf = channel.eventLoop().scheduleAtFixedRate(() -> {
System.out.println("every 60s!");
}, 60, 60, TimeUnit.SECONDS);
sf.cancel(false);
原文地址: https://www.zhblog.net/go/java/tutorial/java-netty-schedule?t=602
1240

被折叠的 条评论
为什么被折叠?



