Skip to content

讨论点 #6

@Harlber

Description

@Harlber
  • 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状态

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions