@Override
   public void run()
   {
      try {
         startBarrier.await();

         int idleCount = 0;
         while (!isRunning.compareAndSet(idleCount > LINGER_ITERATIONS && deadPool.isEmpty() && completionKeyToProcessMap.isEmpty(), false)) {
            idleCount = (!shutdown && process()) ? 0 : (idleCount + 1);
         }
      }
      catch (Exception e) {
         // TODO: how to handle this error?
         e.printStackTrace();
         isRunning.set(false);
      }
   }
@ Override public void run ( ) { try { startBarrier . await ( ) ; int idleCount = 0 ; while ( ! isRunning . compareAndSet ( idleCount > LINGER_ITERATIONS && deadPool . isEmpty ( ) && completionKeyToProcessMap . isEmpty ( ) , false ) ) { idleCount = ( ! shutdown && process ( ) ) ? 0 : ( idleCount + 1 ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; isRunning . set ( false ) ; } }
The primary run loop of the kqueue event processor.