"Force removal of all Leases", resource.getName());
landlord.removeAll();
throw new UnknownLeaseException("Update failed, there are no known leases.");
}
boolean updated = false;
ServiceResource couldNotEnsureLease = null;
for(ServiceResource svcResource : svcResources) {
InstantiatorResource ir = (InstantiatorResource) svcResource.getResource();
logger.trace("Checking for InstantiatorResource match");
if(ir.getInstantiator().equals(preparedResource)) {
logger.trace("Update from {}, current serviceCount {}, serviceLimit {}",
ir.getName(),
deployedServices.size(),
serviceLimit);
logger.trace("Matched InstantiatorResource");
if(!landlord.ensure(svcResource)) {
couldNotEnsureLease = svcResource;
break;
}
updated = true;
logger.trace("Set updated resource capabilities");
ir.setResourceCapability(updatedCapabilities);
logger.trace("Set serviceLimit to {}", serviceLimit);
ir.setServiceLimit(serviceLimit);
try {
logger.trace("Set deployedServices, was: {}, updated count is now: {}",
ir.getServiceCount(), deployedServices.size());
ir.setDeployedServices(deployedServices);
} catch (Throwable t) {
logger.warn("Getting ServiceRecords from {}", ir.getName(), t);
}
/* Process all provision types of Fixed first */
fixedServiceManager.process(svcResource);
/* See if any dynamic provision types are pending */
pendingMgr.process();
break;
} else {
logger.trace("Did not match InstantiatorResource");
}
}
if(couldNotEnsureLease!=null) {
selector.dropServiceResource(couldNotEnsureLease);
throw new UnknownLeaseException("Could not ensure lease. Lease expiration: "+couldNotEnsureLease.getExpiration()+", " +
"current time: "+System.currentTimeMillis());
}
if(!updated) {
logger.warn("Update failed, no matching registration found for {}", resource.getName());
throw new UnknownLeaseException("Update failed, no matching registration found");