summaryrefslogtreecommitdiffstats
path: root/configserver/src
diff options
context:
space:
mode:
Diffstat (limited to 'configserver/src')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java11
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/rpc/GetConfigProcessor.java18
2 files changed, 11 insertions, 18 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
index 7949c2633e0..ffb6c038b70 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
@@ -96,6 +96,7 @@ import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.util.Collection;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -631,15 +632,7 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
.stream()
.filter(fileReference -> ! fileReferencesInUse.contains(fileReference))
.filter(fileReference -> isLastFileAccessBefore(new File(fileReferencesPath, fileReference), instant))
- .sorted((a, b) -> {
- if (a.equals(b))
- return 0;
- else if (lastAccessed(new File(fileReferencesPath, a))
- .isBefore(lastAccessed(new File(fileReferencesPath, b))))
- return -1;
- else
- return 1;
- })
+ .sorted(Comparator.comparing(a -> lastAccessed(new File(fileReferencesPath, a))))
.collect(Collectors.toList());
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/GetConfigProcessor.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/GetConfigProcessor.java
index c31015b533a..3cc1993d09e 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/GetConfigProcessor.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/GetConfigProcessor.java
@@ -6,13 +6,11 @@ import com.yahoo.collections.Pair;
import com.yahoo.component.Version;
import com.yahoo.config.provision.TenantName;
import com.yahoo.container.di.config.ApplicationBundlesConfig;
-import com.yahoo.net.HostName;
-import com.yahoo.vespa.config.PayloadChecksum;
-import com.yahoo.vespa.config.PayloadChecksum.Type;
-import com.yahoo.vespa.config.PayloadChecksums;
import com.yahoo.jrt.Request;
+import com.yahoo.net.HostName;
import com.yahoo.vespa.config.ConfigPayload;
import com.yahoo.vespa.config.ErrorCode;
+import com.yahoo.vespa.config.PayloadChecksums;
import com.yahoo.vespa.config.UnknownConfigIdException;
import com.yahoo.vespa.config.protocol.ConfigResponse;
import com.yahoo.vespa.config.protocol.JRTServerConfigRequest;
@@ -22,11 +20,13 @@ import com.yahoo.vespa.config.protocol.VespaVersion;
import com.yahoo.vespa.config.server.GetConfigContext;
import com.yahoo.vespa.config.server.UnknownConfigDefinitionException;
import com.yahoo.vespa.config.server.tenant.TenantRepository;
-
import java.util.Optional;
+import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
+import static com.yahoo.vespa.config.ErrorCode.APPLICATION_NOT_LOADED;
+import static com.yahoo.vespa.config.ErrorCode.UNKNOWN_VESPA_VERSION;
import static com.yahoo.vespa.config.protocol.SlimeConfigResponse.fromConfigPayload;
/**
@@ -56,7 +56,7 @@ class GetConfigProcessor implements Runnable {
private void respond(JRTServerConfigRequest request) {
Request req = request.getRequest();
if (req.isError()) {
- Level logLevel = (req.errorCode() == ErrorCode.APPLICATION_NOT_LOADED) ? Level.FINE : Level.INFO;
+ Level logLevel = Set.of(APPLICATION_NOT_LOADED, UNKNOWN_VESPA_VERSION).contains(req.errorCode()) ? Level.FINE : Level.INFO;
log.log(logLevel, () -> logPre + req.errorMessage());
}
rpcServer.respond(request);
@@ -98,9 +98,10 @@ class GetConfigProcessor implements Runnable {
GetConfigContext context = rpcServer.createGetConfigContext(tenant, request, trace);
if (context == null || ! context.requestHandler().hasApplication(context.applicationId(), Optional.empty())) {
- handleError(request, ErrorCode.APPLICATION_NOT_LOADED, "No application exists");
+ handleError(request, APPLICATION_NOT_LOADED, "No application exists");
return null;
}
+ logPre = TenantRepository.logPre(context.applicationId());
Optional<Version> vespaVersion = rpcServer.useRequestVersion() ?
request.getVespaVersion().map(VespaVersion::toString).map(Version::fromString) :
@@ -114,7 +115,6 @@ class GetConfigProcessor implements Runnable {
return null;
}
- this.logPre = TenantRepository.logPre(context.applicationId());
ConfigResponse config;
try {
config = rpcServer.resolveConfig(request, context, vespaVersion);
@@ -177,7 +177,7 @@ class GetConfigProcessor implements Runnable {
}
private static String printableVespaVersion(Optional<Version> vespaVersion) {
- return (vespaVersion.isPresent() ? vespaVersion.get().toFullString() : "LATEST");
+ return vespaVersion.map(Version::toFullString).orElse("LATEST");
}
private void returnEmpty(JRTServerConfigRequest request) {