private void performResourceOperations(ContainerOperationTaskState state, Collection<ContainerState> resources, ServiceTaskCallback taskCallback) { if (taskCallback == null) { createCounterSubTaskCallback(state, resources.size(), true, (serviceTask) -> performResourceOperations(state, resources, serviceTask)); return; } try { logInfo("Starting %s of %d container resources", state.operation, resources.size()); for (ContainerState container : resources) { createAdapterRequest(state, container, taskCallback); } } catch (Throwable e) { failTask("Unexpected exception while requesting operation: " + state.operation, e); } }