diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2020-12-14 11:57:52 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2020-12-14 11:57:52 +0100 |
commit | 60b73052b8fb2191c53871cc8faefa4e521c5eb7 (patch) | |
tree | 5924062c3276197d4b869eec1e411b428b6d4cb7 /configserver | |
parent | 8dd6dbf27c66bd3682b6a40683ef1890e99cfd47 (diff) |
Cleaner
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java index 0cc9a804d8c..9966f9c0770 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java @@ -37,7 +37,6 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.StringJoiner; import java.util.stream.Stream; import static java.util.Map.Entry.comparingByKey; @@ -214,8 +213,7 @@ public class ApplicationHandler extends HttpHandler { } if (isReindexRequest(request)) { - String message = triggerReindexing(request, applicationId); - return new JSONResponse(Response.Status.OK) { { object.setString("message", message); } }; + return triggerReindexing(request, applicationId); } if (isReindexingRequest(request)) { @@ -226,7 +224,7 @@ public class ApplicationHandler extends HttpHandler { throw new NotFoundException("Illegal POST request '" + request.getUri() + "'"); } - private String triggerReindexing(HttpRequest request, ApplicationId applicationId) { + private HttpResponse triggerReindexing(HttpRequest request, ApplicationId applicationId) { Set<String> clusters = StringUtilities.split(request.getProperty("clusterId")); Set<String> types = StringUtilities.split(request.getProperty("documentType")); Instant now = applicationRepository.clock().instant(); @@ -242,12 +240,14 @@ public class ApplicationHandler extends HttpHandler { reindexing = reindexing.withReady(cluster, type, now); return reindexing; }); - return "Reindexing " + - (clusters.isEmpty() ? "" - : (types.isEmpty() ? "" - : "document types " + String.join(", ", types) + " in ") + - "clusters " + String.join(", ", clusters) + " of ") + - "application " + applicationId; + + String message = "Reindexing " + + (clusters.isEmpty() ? "" + : (types.isEmpty() ? "" + : "document types " + String.join(", ", types) + " in ") + + "clusters " + String.join(", ", clusters) + " of ") + + "application " + applicationId; + return new JSONResponse(Response.Status.OK) { { object.setString("message", message); } }; } private HttpResponse getReindexingStatus(ApplicationId applicationId) { |