Ejemplo n.º 1
0
 /**
  * Returns the time when this computer last became idle.
  *
  * <p>If this computer is already idle, the return value will point to the time in the past since
  * when this computer has been idle.
  *
  * <p>If this computer is busy, the return value will point to the time in the future where this
  * computer will be expected to become free.
  */
 public final long getIdleStartMilliseconds() {
   long firstIdle = Long.MIN_VALUE;
   for (Executor e : oneOffExecutors) {
     firstIdle = Math.max(firstIdle, e.getIdleStartMilliseconds());
   }
   for (Executor e : executors) {
     firstIdle = Math.max(firstIdle, e.getIdleStartMilliseconds());
   }
   return firstIdle;
 }
Ejemplo n.º 2
0
 /** Decrease the count of slaves being "provisioned". */
 private void decrementAmiSlaveProvision(String ami) {
   synchronized (provisioningAmis) {
     int currentProvisioning;
     try {
       currentProvisioning = provisioningAmis.get(ami);
     } catch (NullPointerException npe) {
       return;
     }
     provisioningAmis.put(ami, Math.max(currentProvisioning - 1, 0));
   }
 }