1.60秒後調用一次
Channel channel = new LocalChannel();
channel.eventLoop().schedule(() -> {
System.out.println("60s!");
}, 60, TimeUnit.SECONDS);
oop
2.每隔60秒調用一次
ScheduledFuture sf = channel.eventLoop().scheduleAtFixedRate(() -> {
System.out.println("every 60s!");
}, 60, 60, TimeUnit.SECONDS);
sf.cancel(false);
原文連接:https://blog.csdn.net/zhwwwcomcn123/article/details/106857404
spa