private void scheduleTimeoutRequestsTimer(){
  PendingRequest nextRequest=getNextTimeoutingPendingRequest();
  if (nextRequest == null) {
    cancelTimeoutPendingRequestTask();
  }
 else {
    TimerTask task=timeoutPendingRequestsTask.get();
    if (task == null || task.scheduledExecutionTime() > nextRequest.timeoutTime) {
      cancelTimeoutPendingRequestTask();
      task=TimerUtil.schedule(timer,timeoutRun,executor,nextRequest.timeoutTime);
      if (!timeoutPendingRequestsTask.compareAndSet(null,task))       task.cancel();
    }
  }
}

private void scheduleTimeoutRequestsTimer ( ) { PendingRequest nextRequest = getNextTimeoutingPendingRequest ( ) ; if ( nextRequest == null ) { cancelTimeoutPendingRequestTask ( ) ; } else { TimerTask task = timeoutPendingRequestsTask . get ( ) ; if ( task == null || task . scheduledExecutionTime ( ) > nextRequest . timeoutTime ) { cancelTimeoutPendingRequestTask ( ) ; task = TimerUtil . schedule ( timer , timeoutRun , executor , nextRequest . timeoutTime ) ; if ( ! timeoutPendingRequestsTask . compareAndSet ( null , task ) ) task . cancel ( ) ; } } }
sets new timer task that timeouts pending requests . if task already exists but is too far in the future , it is canceled and new task assigned
