private void findNonStartedResourceComponentsRecursively(InventoryManager im, Resource resource,
Map<ResourceType, ResourceContainer> nonStartedResourceContainersByType) throws Exception {
ResourceType resourceType = resource.getResourceType();
if (!nonStartedResourceContainersByType.containsKey(resourceType)) {
ResourceContainer resourceContainer = im.getResourceContainer(resource);
if (resourceContainer.getResourceComponentState() == ResourceContainer.ResourceComponentState.STARTING) {
// give it 5s to finish starting
try {
System.out.println("Resource is STARTING, Waiting 5s before checking for STARTED " + resource);
Thread.sleep(5000L);
} catch (InterruptedException e) {
// keep going
}
}
if (resourceContainer.getResourceComponentState() != ResourceContainer.ResourceComponentState.STARTED) {
nonStartedResourceContainersByType.put(resourceType, resourceContainer);
} else if (resourceContainer.getResourceComponent() == null) {
System.err.println("****** Resource container " + resourceContainer
+ " says its Resource component is started, but the component is null. ******");
nonStartedResourceContainersByType.put(resourceType, resourceContainer);
}
}