private void removeOrphanedResourceGroupMembers() { final Collection<GroupMember> members = resourceGroupManager.getOrphanedResourceGroupMembers(); if (!members.isEmpty()) { log.info("cleaning up " + members.size() + " orphaned group members"); } for (final GroupMember m : members) { resourceGroupManager.removeGroupMember(m); } }
@SuppressWarnings("unchecked") private void removeDeletedResources( Map<Integer, List<AppdefEntityID>> agentCache, Collection<String> typeNames) throws ApplicationException, VetoException { final boolean debug = log.isDebugEnabled(); final StopWatch watch = new StopWatch(); final AuthzSubject subject = authzSubjectManager.findSubjectById(AuthzConstants.overlordId); if (debug) watch.markTimeBegin("unscheduleMeasurementsForAsyncDelete"); unscheduleMeasurementsForAsyncDelete(agentCache); if (debug) watch.markTimeEnd("unscheduleMeasurementsForAsyncDelete"); // Look through services, servers, platforms, applications, and groups if (debug) watch.markTimeBegin("removeApplications"); Collection<Application> applications = applicationManager.findDeletedApplications(); removeApplications(subject, applications); if (debug) watch.markTimeEnd("removeApplications"); if (debug) watch.markTimeBegin("removeResourceGroups"); Collection<ResourceGroup> groups = resourceGroupManager.findDeletedGroups(); removeResourceGroups(subject, groups); if (debug) watch.markTimeEnd("removeResourceGroups"); typeNames = (typeNames == null) ? Collections.EMPTY_LIST : typeNames; if (debug) watch.markTimeBegin("removeGroupsCompatibleWith"); for (String name : typeNames) { resourceGroupManager.removeGroupsCompatibleWith(name); } if (debug) watch.markTimeEnd("removeGroupsCompatibleWith"); Collection<Service> services = serviceManager.findDeletedServices(); removeServices(subject, services); Collection<Server> servers = serverManager.findDeletedServers(); removeServers(subject, servers); if (debug) watch.markTimeBegin("removePlatforms"); Collection<Platform> platforms = platformManager.findDeletedPlatforms(); removePlatforms(subject, platforms); if (debug) watch.markTimeEnd("removePlatforms"); if (debug) log.debug("removeDeletedResources: " + watch); }
private final void removeResourceGroups(AuthzSubject subject, Collection<ResourceGroup> groups) { for (ResourceGroup group : groups) { try { resourceGroupManager.removeResourceGroup(subject, group.getId()); } catch (Exception e) { log.error("Unable to remove group: " + e, e); } } if (log.isDebugEnabled()) { log.debug("Removed " + groups.size() + " resource groups"); } }