private void decrementAllocation(ReservationAllocation reservation) { assert (readWriteLock.isWriteLockedByCurrentThread()); Map<ReservationInterval, ReservationRequest> allocationRequests = reservation.getAllocationRequests(); String user = reservation.getUser(); RLESparseResourceAllocation resAlloc = userResourceAlloc.get(user); for (Map.Entry<ReservationInterval, ReservationRequest> r : allocationRequests .entrySet()) { resAlloc.removeInterval(r.getKey(), r.getValue()); rleSparseVector.removeInterval(r.getKey(), r.getValue()); } if (resAlloc.isEmpty()) { userResourceAlloc.remove(user); } }
private void decrementAllocation(ReservationAllocation reservation) { assert (readWriteLock.isWriteLockedByCurrentThread()); Map<ReservationInterval, ReservationRequest> allocationRequests = reservation.getAllocationRequests(); String user = reservation.getUser(); RLESparseResourceAllocation resAlloc = userResourceAlloc.get(user); for (Map.Entry<ReservationInterval, ReservationRequest> r : allocationRequests .entrySet()) { resAlloc.removeInterval(r.getKey(), r.getValue()); rleSparseVector.removeInterval(r.getKey(), r.getValue()); } if (resAlloc.isEmpty()) { userResourceAlloc.remove(user); } }
ReservationInterval newInterval = new ReservationInterval(0, diff); periodicRle.removeInterval(newInterval, r.getValue()); resAlloc.removeInterval(newInterval, r.getValue()); new ReservationInterval(rStart, rEnd); periodicRle.removeInterval(newInterval, r.getValue()); resAlloc.removeInterval(newInterval, r.getValue()); rleSparseVector.removeInterval(r.getKey(), r.getValue()); resAlloc.removeInterval(r.getKey(), r.getValue()); if (Resources.greaterThan(resCalc, totalCapacity, r.getValue(), ZERO_RESOURCE)) { latestActive = Long.MAX_VALUE; resCount.removeInterval( new ReservationInterval(earliestActive, latestActive), Resource.newInstance(1, 1));
/** * Removes a resource for the specified interval. * * @param interval the {@link ReservationInterval} for which the resource is * to be removed. * @param resource the {@link Resource} to be removed. * @return true if removal is successful, false otherwise */ public boolean removeInterval(ReservationInterval interval, Resource resource) { long startTime = interval.getStartTime(); long endTime = interval.getEndTime(); // If the resource to be subtracted is less than the minimum resource in // the range, abort removal to avoid negative capacity. // TODO revesit decrementing endTime if (!Resources.fitsIn(resource, getMinimumCapacityInInterval( new ReservationInterval(startTime, endTime - 1)))) { LOG.info("Request to remove more resources than what is available"); return false; } if (startTime >= 0 && endTime > startTime && endTime <= timePeriod) { return super.removeInterval(interval, resource); } else { LOG.info("Interval extends beyond the end time " + timePeriod); return false; } }
planModifications.removeInterval(tempAllocation.getKey(), tempAllocation.getValue());
.entrySet()) { planModifications.removeInterval(tempAllocation.getKey(), tempAllocation.getValue());
planModifications.removeInterval(tempAllocation.getKey(), tempAllocation.getValue());
tempAssigned.removeInterval(tempAllocation.getKey(), tempAllocation.getValue());
tempAssigned.removeInterval(tempAllocation.getKey(), tempAllocation.getValue());
rleSparseVector.getCapacityAtTime(start + alloc.length + 2)); for (Entry<ReservationInterval, ReservationRequest> ip : inputs) { rleSparseVector.removeInterval(ip.getKey(), ip.getValue());
rleSparseVector.getCapacityAtTime(start + alloc.length + 2)); for (Entry<ReservationInterval, Resource> ip : inputs) { rleSparseVector.removeInterval(ip.getKey(), ip.getValue());
rleSparseVector.getCapacityAtTime(start + alloc.length + 2)); for (Entry<ReservationInterval, Resource> ip : inputs) { rleSparseVector.removeInterval(ip.getKey(), ip.getValue());
rleSparseVector.getCapacityAtTime(start + alloc.length + 2)); for (Entry<ReservationInterval, ReservationRequest> ip : inputs) { rleSparseVector.removeInterval(ip.getKey(), ip.getValue());
rleSparseVector.getCapacityAtTime(start + alloc.length + 2)); for (Entry<ReservationInterval, ReservationRequest> ip : inputs) { rleSparseVector.removeInterval(ip.getKey(), ip.getValue());
rleSparseVector.getCapacityAtTime(start + alloc.length + 2)); for (Entry<ReservationInterval, Resource> ip : inputs) { rleSparseVector.removeInterval(ip.getKey(), ip.getValue());
LOG.info(rleSparseVector.toString()); rleSparseVector.removeInterval(riRemove, rr); LOG.info(rleSparseVector.toString()); rleSparseVector.removeInterval(riRemove2, rr); LOG.info(rleSparseVector.toString());