use of com.yahoo.vespa.orchestrator.BatchInternalErrorException in project vespa by vespa-engine.
the class HostSuspensionResource method suspendAll.
@Override
public BatchOperationResult suspendAll(String parentHostnameString, List<String> hostnamesAsStrings) {
HostName parentHostname = new HostName(parentHostnameString);
List<HostName> hostnames = hostnamesAsStrings.stream().map(HostName::new).collect(Collectors.toList());
try {
orchestrator.suspendAll(parentHostname, hostnames);
} catch (BatchHostStateChangeDeniedException e) {
log.log(LogLevel.DEBUG, "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname, e);
throw createWebApplicationException(e.getMessage(), Response.Status.CONFLICT);
} catch (BatchHostNameNotFoundException e) {
log.log(LogLevel.DEBUG, "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname, e);
// by the URL path was found. It's one of the hostnames in the request it failed to find.
throw createWebApplicationException(e.getMessage(), Response.Status.BAD_REQUEST);
} catch (BatchInternalErrorException e) {
log.log(LogLevel.DEBUG, "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname, e);
throw createWebApplicationException(e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR);
}
log.log(LogLevel.DEBUG, "Suspended " + hostnames + " with parent " + parentHostname);
return BatchOperationResult.successResult();
}
Aggregations