Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

讨论点 #6

Open
Harlber opened this issue Aug 22, 2018 · 0 comments
Open

讨论点 #6

Harlber opened this issue Aug 22, 2018 · 0 comments

Comments

@Harlber
Copy link

Harlber commented Aug 22, 2018

  • ListenerQueue中,pop,push方法 pop用了synchronized锁,push没有,实际上callBackQueue使用的ConcurrentHashMap 是线程安全的
   //以前是TimerTask处理方式
   private void startTimer() {
       if(!stopFlag && hasTask == false) {
           hasTask = true;
           timerHandler.postDelayed(new Runnable() {
               @Override
               public void run() {
                   timerImpl();
                   hasTask = false;
                   startTimer();
               }
           }, 5 * 1000);
       }
   }

延时5秒的定时任务会导致极端情况下,超时时间会延长5秒

  • netty可以升级了
  • 心跳不建议定时发送,而是监听channel的active状态
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant