private void triggerNextRequest(){
  schedulingLock.lock();
  try {
    double time=getTime();
    double lowestReservation=Double.MAX_VALUE;
    Tenant lowestReservationTenant=null;
    double lowestWeight=Double.MAX_VALUE;
    Tenant lowestWeightTenant=null;
    for (    Tenant tenant : tenants) {
      DiskRequest next=tenant.peek();
      if (next == null) {
        continue;
      }
      double reservation=next.reservation();
      if (reservation <= time && reservation < lowestReservation) {
        lowestReservation=reservation;
        lowestReservationTenant=tenant;
      }
      if (lowestReservationTenant == null) {
        double weight=next.weight();
        if (weight < lowestWeight) {
          lowestWeight=weight;
          lowestWeightTenant=tenant;
        }
      }
    }
    DiskRequest request;
    if (lowestReservationTenant != null) {
      request=lowestReservationTenant.takeReserved(time);
    }
 else {
      request=lowestWeightTenant.takeWeight(time);
    }
    if (DEBUG)     print("trigger","%s",request);
    request.trigger();
  }
  finally {
    schedulingLock.unlock();
  }
}

private void triggerNextRequest ( ) { schedulingLock . lock ( ) ; try { double time = getTime ( ) ; double lowestReservation = Double . MAX_VALUE ; Tenant lowestReservationTenant = null ; double lowestWeight = Double . MAX_VALUE ; Tenant lowestWeightTenant = null ; for ( Tenant tenant : tenants ) { DiskRequest next = tenant . peek ( ) ; if ( next == null ) { continue ; } double reservation = next . reservation ( ) ; if ( reservation <= time && reservation < lowestReservation ) { lowestReservation = reservation ; lowestReservationTenant = tenant ; } if ( lowestReservationTenant == null ) { double weight = next . weight ( ) ; if ( weight < lowestWeight ) { lowestWeight = weight ; lowestWeightTenant = tenant ; } } } DiskRequest request ; if ( lowestReservationTenant != null ) { request = lowestReservationTenant . takeReserved ( time ) ; } else { request = lowestWeightTenant . takeWeight ( time ) ; } if ( DEBUG ) print ( "trigger" , "%s" , request ) ; request . trigger ( ) ; } finally { schedulingLock . unlock ( ) ; } }
we have claimed a request slot using should_schedule , now we wait our turn to grab a request and trigger it
