new ServiceDocumentQuery<>(getHost(), ContainerState.class) .query(compositeQueryTask, (r) -> { if (r.hasException()) { logSevere("Failed to retrieve containers, sharing the same" + " container description: %s -%s", r.getDocumentSelfLink(), r.getException()); } else if (r.hasResult()) { resourcesSharingDesc.add(r.getDocumentSelfLink()); } else { AtomicLong skipDeleteDescriptionOperationException = new AtomicLong();
.query(compositeQueryTask, (r) -> { if (r.hasException()) { logSevere( "Failed to retrieve composite-descriptions: %s - %s", r.getDocumentSelfLink(), r.getException()); } else if (r.hasResult()) { ContainerDescription containerDesc = r.getResult(); List<String> newLinksList = new ArrayList<>();
if (r.hasException()) { logWarning("Failed to retrieve containers for host: %s", containerHostLink); } else { logFine("Found %s containers for container host: %s", String.valueOf(r.getCount()), containerHostLink); state.customProperties.put( ContainerHostService.NUMBER_OF_CONTAINERS_PER_HOST_PROP_NAME, String.valueOf(r.getCount())); if (counter.decrementAndGet() == 0) { patchHostState(containerHostLink, state); new ServiceDocumentQuery<ContainerState>(getHost(), ContainerState.class) .query(systemContainerQuery, (result) -> { if (result.hasException()) { logWarning("Failed to retrieve system containers for host: %s", containerHostLink); state.customProperties.put( ContainerHostService.NUMBER_OF_SYSTEM_CONTAINERS_PROP_NAME, String.valueOf(result.getCount())); if (counter.decrementAndGet() == 0) { patchHostState(containerHostLink, state);
new ServiceDocumentQuery<>(host, ContainerState.class).query( queryTask, (r) -> { if (r.hasException()) { if (containerStateSelfLink.get() != null) { return; host.failIteration(r.getException()); } else if (r.hasResult()) { containerStateSelfLink.set(r.getDocumentSelfLink()); } else { host.completeIteration();
host, null).query(qt, (r) -> { if (r.hasException()) { ai.set(Integer.MAX_VALUE); if (r.hasResult()) { ai.set((int) r.getCount()); } else { ai.set(Integer.MAX_VALUE); host, null).query(qt, (r) -> { if (r.hasException()) { host.failIteration(r.getException()); return; if (r.hasResult()) { containerStatesList.add(r.getDocumentSelfLink()); return;
if (r.hasException()) { initEx[0] = r.getException(); return; initCount[0] = (int) r.getCount(); initDone[0] = true; }); if (r.hasException()) { ex[0] = r.getException(); return; done[0] = (initCount[0] + count == r.getCount()); });
new ServiceDocumentQuery<Closure>(getHost(), Closure.class) .query(compositeQueryTask, (r) -> { if (r.hasException()) { logSevere("Failed to retrieve closures, sharing the same" + " closureDescription: %s -%s", r.getDocumentSelfLink(), r.getException()); } else if (r.hasResult()) { resourcesSharingDesc.add(r.getDocumentSelfLink()); } else { AtomicLong skipDeleteDescriptionOperationException = new AtomicLong();
new ServiceDocumentQuery<>(getHost(), ComputeState.class) .query(computeTask, (r) -> { if (r.hasException()) { logWarning("Failed query for compute count for deployment policy=%s: %s", getSelfLink(), Utils.toString(r.getException())); delete.fail(r.getException()); return; } else if (r.hasResult() && r.getCount() != 0) { delete.fail(new LocalizableValidationException("Deployment Policy is in use", "compute.deployment-policy.in.use")); if (r.hasException()) { logWarning("Failed query for placements count for deployment policy=%s: %s", getSelfLink(), Utils.toString(r.getException())); delete.fail(r.getException()); return; } else if (r.hasResult() && r.getCount() != 0) { delete.fail( new LocalizableValidationException("Deployment Policy is in use",
new ServiceDocumentQuery<>(getHost(), null).query(queryTask, (r) -> { if (r.hasException()) { op.fail(r.getException()); } else if (r.hasResult()) { if (r.getDocumentSelfLink() .startsWith(ContainerDescriptionService.FACTORY_LINK)) { ContainerDescription containerDescription = Utils.fromJson( r.getRawResult(), ContainerDescription.class); images.put(containerDescription.documentSelfLink, containerDescription.image); imagesResult.tenantLinks = containerDescription.tenantLinks; } else if (r.getDocumentSelfLink().startsWith( ClosureDescriptionFactoryService.FACTORY_LINK)) { ClosureDescription closureDescription = Utils.fromJson( r.getRawResult(), ClosureDescription.class); images.put(closureDescription.documentSelfLink, closureDescription.runtime); imagesResult.tenantLinks = closureDescription.tenantLinks; } else { logWarning("Unexpected result type: %s", r.getDocumentSelfLink());
new ServiceDocumentQuery<>(getHost(), ContainerService.ContainerState.class).query( registryQuery, (r) -> { if (r.hasException()) { fail(context.request, r.getException()); return; } else if (r.hasResult()) { registryLinks.add(r.getDocumentSelfLink()); } else { if (registryLinks.isEmpty()) {
if (r.hasException()) { logger.warning(String.format("Failed to query resource container state with id [%s]", containerId)); } else if (r.hasResult()) { cs.documentSelfLink = r.getDocumentSelfLink(); patchContainerState(cs);
if (r.hasException()) { logSevere("Failed to retrieve child containers for: %s - %s", containerDescriptionLink, r.getException()); } else if (r.hasResult() && r.getCount() != 0) { logFine("Child containers for: %s = %s", containerDescriptionLink, r.getCount());
.query(descQuery, (r) -> { if (r.hasException()) { host.log( Level.WARNING, "Exception while filtering container descriptions with %s %s. Error: [%s]", affinityPropertyName, getAffinity(), r.getException() .getMessage()); callback.complete(null, r.getException()); } else if (r.hasResult()) { final ContainerDescription desc = r.getResult(); final DescName descName = new DescName(); if (desc == null) { descName.descLink = r.getDocumentSelfLink(); containerDescLinksWithNames.put(descName.descLink, descName); } else if (getAffinity().isEmpty() || getAffinity().contains(desc.name)) {
new ServiceDocumentQuery<>(getHost(), GroupResourcePlacementState.class).query(queryTask, (r) -> { if (r.hasException()) { + " removal: %s", Utils.toString(r.getException())); } else if (r.hasResult()) { r.getDocumentSelfLink()); deleteOps.add(delete);
getHost(), ComputeDescription.class); query.query(q, (r) -> { if (r.hasException()) { failTask("Error querying for placement compute description.", r.getException()); } else if (r.hasResult()) { computeDescriptionLinks.add(r.getDocumentSelfLink()); } else { if (computeDescriptionLinks.isEmpty()) {
new ServiceDocumentQuery<>(getHost(), null).query(componentDescriptionQueryTask, (r) -> { if (r.hasException()) { get.fail(r.getException()); } else if (r.hasResult()) { ComponentMeta meta = CompositeComponentRegistry .metaByDescriptionLink(r.getDocumentSelfLink()); ResourceState description = Utils.fromJson(r.getRawResult(), meta.descriptionClass); if (description != null) { componentDescriptions.add(cd); } else { logWarning("Unexpected result type: %s", r.getDocumentSelfLink());
if (r.hasException()) { logSevere("Failed to query resource descriptions: %s", Utils.toString(r.getException())); deferredResult.fail(r.getException()); } else if (r.hasResult()) { String documentLink = r.getDocumentSelfLink(); logInfo("Found description of resource: %s", documentLink); documentLinks.add(documentLink);
if (r.hasException()) { host.log( Level.WARNING, "Exception while selecting container volumes with contextId [%s]. Error: [%s]", state.contextId, r.getException().getMessage()); callback.complete(null, r.getException()); } else if (r.getCount() > 0) {
new ServiceDocumentQuery<RequestStatus>(getHost(), RequestStatus.class) .query(requestStatusQuery, (r) -> { if (r.hasException()) { get.fail(r.getException()); return; } else { state.activeRequestsCount = r.getCount(); if (counter.hasException()) { get.fail(counter.getException()); return; state.recentEventLogsCount = counter.getCount();
if (r.hasException()) { failTask("Failure retrieving query results", r.getException()); } else if (r.hasResult()) { kubernetesLinks.add(r.getDocumentSelfLink()); } else { if (kubernetesLinks.isEmpty()) {