aboutsummaryrefslogtreecommitdiffstats
path: root/orchestrator
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-04-28 15:56:45 +0200
committerJon Marius Venstad <venstad@gmail.com>2021-04-28 15:56:45 +0200
commit5d2c85de4e5e5f9182189cb2aaf9369070f41533 (patch)
tree306f65d364d04f5c23e41b8cdc3d3c90c7162342 /orchestrator
parent4fbd27dddde4aff5de1be48f79057b6357bed123 (diff)
More lazy debug log message generation
Diffstat (limited to 'orchestrator')
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostRequestHandler.java20
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionRequestHandler.java10
2 files changed, 15 insertions, 15 deletions
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostRequestHandler.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostRequestHandler.java
index 7b28925205f..4b8b295964a 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostRequestHandler.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostRequestHandler.java
@@ -90,10 +90,10 @@ public class HostRequestHandler extends RestApiRequestHandler<HostRequestHandler
applicationUri.toString(),
hostServices);
} catch (UncheckedTimeoutException e) {
- log.log(Level.FINE, "Failed to get host " + hostName + ": " + e.getMessage());
+ log.log(Level.FINE, () -> "Failed to get host " + hostName + ": " + e.getMessage());
throw restApiExceptionFromTimeout("getHost", hostName, e);
} catch (HostNameNotFoundException e) {
- log.log(Level.FINE, "Host not found: " + hostName);
+ log.log(Level.FINE, () -> "Host not found: " + hostName);
throw new RestApiException.NotFound(e);
}
}
@@ -116,10 +116,10 @@ public class HostRequestHandler extends RestApiRequestHandler<HostRequestHandler
try {
orchestrator.setNodeStatus(hostName, state);
} catch (HostNameNotFoundException e) {
- log.log(Level.FINE, "Host not found: " + hostName);
+ log.log(Level.FINE, () -> "Host not found: " + hostName);
throw new RestApiException.NotFound(e);
} catch (UncheckedTimeoutException e) {
- log.log(Level.FINE, "Failed to patch " + hostName + ": " + e.getMessage());
+ log.log(Level.FINE, () -> "Failed to patch " + hostName + ": " + e.getMessage());
throw restApiExceptionFromTimeout("patch", hostName, e);
} catch (OrchestrationException e) {
String message = "Failed to set " + hostName + " to " + state + ": " + e.getMessage();
@@ -150,13 +150,13 @@ public class HostRequestHandler extends RestApiRequestHandler<HostRequestHandler
try {
orchestrator.suspend(hostName);
} catch (HostNameNotFoundException e) {
- log.log(Level.FINE, "Host not found: " + hostName);
+ log.log(Level.FINE, () -> "Host not found: " + hostName);
throw new RestApiException.NotFound(e);
} catch (UncheckedTimeoutException e) {
- log.log(Level.FINE, "Failed to suspend " + hostName + ": " + e.getMessage());
+ log.log(Level.FINE, () -> "Failed to suspend " + hostName + ": " + e.getMessage());
throw restApiExceptionFromTimeout("suspend", hostName, e);
} catch (HostStateChangeDeniedException e) {
- log.log(Level.FINE, "Failed to suspend " + hostName + ": " + e.getMessage());
+ log.log(Level.FINE, () -> "Failed to suspend " + hostName + ": " + e.getMessage());
throw restApiExceptionWithDenialReason("suspend", hostName, e);
}
return new UpdateHostResponse(hostName.s(), null);
@@ -173,13 +173,13 @@ public class HostRequestHandler extends RestApiRequestHandler<HostRequestHandler
try {
orchestrator.resume(hostName);
} catch (HostNameNotFoundException e) {
- log.log(Level.FINE, "Host not found: " + hostName);
+ log.log(Level.FINE, () -> "Host not found: " + hostName);
throw new RestApiException.NotFound(e);
} catch (UncheckedTimeoutException e) {
- log.log(Level.FINE, "Failed to resume " + hostName + ": " + e.getMessage());
+ log.log(Level.FINE, () -> "Failed to resume " + hostName + ": " + e.getMessage());
throw restApiExceptionFromTimeout("resume", hostName, e);
} catch (HostStateChangeDeniedException e) {
- log.log(Level.FINE, "Failed to resume " + hostName + ": " + e.getMessage());
+ log.log(Level.FINE, () -> "Failed to resume " + hostName + ": " + e.getMessage());
throw restApiExceptionWithDenialReason("resume", hostName, e);
}
return new UpdateHostResponse(hostName.s(), null);
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionRequestHandler.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionRequestHandler.java
index 73859f385e1..d2fdf70df19 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionRequestHandler.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionRequestHandler.java
@@ -54,21 +54,21 @@ public class HostSuspensionRequestHandler extends RestApiRequestHandler<HostSusp
try {
orchestrator.suspendAll(parentHostname, hostnames);
} catch (BatchHostStateChangeDeniedException e) {
- log.log(Level.FINE, "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname, e);
+ log.log(Level.FINE, e, () -> "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname);
throw createRestApiException(e.getMessage(), Response.Status.CONFLICT, e);
} catch (UncheckedTimeoutException e) {
- log.log(Level.FINE, "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname, e);
+ log.log(Level.FINE, e, () -> "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname);
throw createRestApiException(e.getMessage(), Response.Status.CONFLICT, e);
} catch (BatchHostNameNotFoundException e) {
- log.log(Level.FINE, "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname, e);
+ log.log(Level.FINE, e, () -> "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname);
// Note that we're returning BAD_REQUEST instead of NOT_FOUND because the resource identified
// by the URL path was found. It's one of the hostnames in the request it failed to find.
throw createRestApiException(e.getMessage(), Response.Status.BAD_REQUEST, e);
} catch (BatchInternalErrorException e) {
- log.log(Level.FINE, "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname, e);
+ log.log(Level.FINE, e, () -> "Failed to suspend nodes " + hostnames + " with parent host " + parentHostname);
throw createRestApiException(e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR, e);
}
- log.log(Level.FINE, "Suspended " + hostnames + " with parent " + parentHostname);
+ log.log(Level.FINE, () -> "Suspended " + hostnames + " with parent " + parentHostname);
return BatchOperationResult.successResult();
}