GithubHelp home page GithubHelp logo

Comments (8)

gcnyin avatar gcnyin commented on May 28, 2024

image

from vproxy.

gcnyin avatar gcnyin commented on May 28, 2024

接口有点奇怪啊。不应该是类似于这种吗

interface Timer {
  void runDelayed(Runnable r, long step, TimeUnit tu);
}

from vproxy.

wkgcass avatar wkgcass commented on May 28, 2024

接口有点奇怪啊。不应该是类似于这种吗

interface Timer {
  void runDelayed(Runnable r, long step, TimeUnit tu);
}

不应该

from vproxy.

gcnyin avatar gcnyin commented on May 28, 2024

image

from vproxy.

gcnyin avatar gcnyin commented on May 28, 2024

@wkgcass

这个接口设计是有原因的。因为selector要根据最近定时任务的时间poll,还要根据是否有定时任务来决定是否永久等待。而且定时任务还可以随时取消。

from vproxy.

wkgcass avatar wkgcass commented on May 28, 2024

这个接口设计是有原因的。因为selector要根据最近定时任务的时间poll,还要根据是否有定时任务来决定是否永久等待。而且定时任务还可以随时取消。
这里除了TimeElem的get方法是个util之外其他都是有实际作用的。

from vproxy.

gcnyin avatar gcnyin commented on May 28, 2024

PriorityQueue<TimeElemImpl<T>> queue = new PriorityQueue<>((a, b) -> (int) (a.triggerTime - b.triggerTime));

@wkgcass 这块写的有点问题,如果差大于Integer.MAX_VALUE 2147483647就溢出了。建议改成

 PriorityQueue<TimeElemImpl<T>> queue = new PriorityQueue<>(Comparator.comparingLong(elem -> elem.triggerTime)); 

from vproxy.

gcnyin avatar gcnyin commented on May 28, 2024

我在我的branch里改吧

from vproxy.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.