Netty-时间轮

把书读薄 / 2024-04-25 / 原文

Netty的时间轮

        HashedWheelTimer hashedWheelTimer = new HashedWheelTimer();
        TimerTask timerTask = new TimerTask() {
            @Override
            public void run(Timeout timeout) throws Exception {
          //执行具体的业务逻辑
            }
        };
        hashedWheelTimer.newTimeout(timerTask, 0, java.util.concurrent.TimeUnit.SECONDS);