Tut-android icon indicating copy to clipboard operation
Tut-android copied to clipboard

讨论点

Open Harlber opened this issue 7 years ago • 0 comments

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

Harlber avatar Aug 22 '18 03:08 Harlber