/** * Update all known Provisioners of the new ResourceCapability * * @param resourceCapability The ResourceCapability object * @param deployedServices List of deployed services */ void updateMonitors( ResourceCapability resourceCapability, List<DeployedService> deployedServices) { ProvisionLeaseManager[] mgrs; synchronized (leaseTable) { Collection<ProvisionLeaseManager> c = leaseTable.values(); mgrs = c.toArray(new ProvisionLeaseManager[c.size()]); } if (mgrs == null) return; if (mgrs.length == 0) return; for (ProvisionLeaseManager mgr : mgrs) { try { mgr.provisioner.update( adapter.getInstantiator(), resourceCapability, deployedServices, serviceLimit); } catch (Throwable t) { if (logger.isLoggable(Level.FINEST)) logger.log(Level.FINEST, "Updating ProvisionManager", t); boolean connected = false; /* Determine if we should even try to reconnect */ final int category = ThrowableConstants.retryable(t); if (category == ThrowableConstants.INDEFINITE || category == ThrowableConstants.UNCATEGORIZED) { connected = mgr.reconnect(); } if (!connected) { removeProvisionManager(mgr.provisioner, mgr.serviceID); } } } }
/** * Cancel the registration to a monitor * * @param monitor The monior to cancel */ void cancelRegistration(Object monitor) { synchronized (leaseTable) { ProvisionLeaseManager leaseManager = leaseTable.remove(monitor); if (leaseManager != null) { leaseManager.drop(false); } } }