diff options
author | Jon Bratseth <bratseth@gmail.com> | 2020-06-10 12:42:51 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2020-06-10 12:42:51 +0200 |
commit | 49ad958565e4db19872bfb1a069a0209a652c011 (patch) | |
tree | 87ae37bfaa752aefc8452ee8611e32f4adb15d85 | |
parent | 7f55a0f05ea9ab8d684e278f832a175ab543b9df (diff) |
Nonfunctional changes only
8 files changed, 45 insertions, 74 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java b/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java index b0ac59718aa..5795770c294 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java @@ -1,10 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config.provision.zone; -import com.yahoo.config.provision.CloudName; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.SystemName; import java.util.Objects; diff --git a/docproc/src/main/java/com/yahoo/docproc/jdisc/messagebus/MbusRequestContext.java b/docproc/src/main/java/com/yahoo/docproc/jdisc/messagebus/MbusRequestContext.java index 2da494e19cf..a9bd63d96c3 100644 --- a/docproc/src/main/java/com/yahoo/docproc/jdisc/messagebus/MbusRequestContext.java +++ b/docproc/src/main/java/com/yahoo/docproc/jdisc/messagebus/MbusRequestContext.java @@ -75,9 +75,8 @@ public class MbusRequestContext implements RequestContext, ResponseHandler { @Override public void skip() { - if (deserialized.get()) { - throw new IllegalStateException("Can not skip processing after deserialization."); - } + if (deserialized.get()) + throw new IllegalStateException("Can not skip processing after deserialization"); dispatchRequest(requestMsg, request.getUri().getPath(), responseHandler); } @@ -91,10 +90,7 @@ public class MbusRequestContext implements RequestContext, ResponseHandler { } } } - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, "Forwarding " + messages.size() + " messages from " + processings.size() + - " processings."); - } + log.log(Level.FINE, () ->"Forwarding " + messages.size() + " messages from " + processings.size() + " processings."); if (messages.isEmpty()) { dispatchResponse(Response.Status.OK); return; @@ -102,10 +98,10 @@ public class MbusRequestContext implements RequestContext, ResponseHandler { long inputSequenceId = requestMsg.getSequenceId(); ResponseMerger responseHandler = new ResponseMerger(requestMsg, messages.size(), this); for (Message message : messages) { - // See comment for internalNoThrottledSource. - dispatchRequest(message, (inputSequenceId == message.getSequenceId()) - ? getUri().getPath() - : "/" + internalNoThrottledSource, + // See comment for internalNoThrottledSource + dispatchRequest(message, + message.getSequenceId() == inputSequenceId ? getUri().getPath() + : "/" + internalNoThrottledSource, responseHandler); } } @@ -177,7 +173,7 @@ public class MbusRequestContext implements RequestContext, ResponseHandler { ResponseDispatch.newInstance(new MbusResponse(status, requestMsg.createReply())).dispatch(this); } - private void dispatchRequest(final Message msg, final String uriPath, final ResponseHandler handler) { + private void dispatchRequest(Message msg, String uriPath, ResponseHandler handler) { try { new RequestDispatch() { @@ -197,15 +193,10 @@ public class MbusRequestContext implements RequestContext, ResponseHandler { } } - private static MessageFactory newMessageFactory(final DocumentMessage msg) { - if (msg == null) { - return null; - } - final Route route = msg.getRoute(); - if (route == null || !route.hasHops()) { - return null; - } - return new MessageFactory(msg); + private static MessageFactory newMessageFactory(DocumentMessage message) { + if (message == null) return null; + if (message.getRoute() == null || ! message.getRoute().hasHops()) return null; + return new MessageFactory(message); } private static URI resolveUri(String path) { diff --git a/docproc/src/main/java/com/yahoo/docproc/jdisc/messagebus/MessageFactory.java b/docproc/src/main/java/com/yahoo/docproc/jdisc/messagebus/MessageFactory.java index 92f4952b5b5..1365ed955fc 100644 --- a/docproc/src/main/java/com/yahoo/docproc/jdisc/messagebus/MessageFactory.java +++ b/docproc/src/main/java/com/yahoo/docproc/jdisc/messagebus/MessageFactory.java @@ -42,14 +42,12 @@ class MessageFactory { message.setTimeReceivedNow(); message.setTimeRemaining(requestMsg.getTimeRemainingNow()); message.getTrace().setLevel(requestMsg.getTrace().getLevel()); - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, "Created '" + message.getClass().getName() + - "', route = '" + message.getRoute() + - "', priority = '" + message.getPriority().name() + - "', load type = '" + message.getLoadType() + - "', trace level = '" + message.getTrace().getLevel() + - "', time remaining = '" + message.getTimeRemaining() + "'."); - } + log.log(Level.FINE, () -> "Created '" + message.getClass().getName() + + "', route = '" + message.getRoute() + + "', priority = '" + message.getPriority().name() + + "', load type = '" + message.getLoadType() + + "', trace level = '" + message.getTrace().getLevel() + + "', time remaining = '" + message.getTimeRemaining() + "'."); return message; } diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/DocumentMessage.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/DocumentMessage.java index 0db239b33bf..dbe6bb2ff45 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/DocumentMessage.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/DocumentMessage.java @@ -82,4 +82,5 @@ public abstract class DocumentMessage extends Message { public Utf8String getProtocol() { return DocumentProtocol.NAME; } + } diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java b/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java index 466e74202c1..25194a5502a 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java @@ -116,20 +116,15 @@ public class Request extends AbstractResource { setUri(uri); } - /** - * <p>Returns the {@link Container} for which this Request was created.</p> - * - * @return The container instance. - */ + /** Returns the {@link Container} for which this Request was created */ public Container container() { return parent != null ? parent.container() : container; } /** - * <p>Returns the Uniform Resource Identifier used by the {@link Container} to resolve the appropriate {@link - * RequestHandler} for this Request.</p> + * Returns the Uniform Resource Identifier used by the {@link Container} to resolve the appropriate {@link + * RequestHandler} for this Request * - * @return The resource identifier. * @see #setUri(URI) */ public URI getUri() { @@ -137,12 +132,12 @@ public class Request extends AbstractResource { } /** - * <p>Sets the Uniform Resource Identifier used by the {@link Container} to resolve the appropriate {@link + * Sets the Uniform Resource Identifier used by the {@link Container} to resolve the appropriate {@link * RequestHandler} for this Request. Because access to the URI is not guarded by any lock, any changes made after - * calling {@link #connect(ResponseHandler)} might never become visible to other threads.</p> + * calling {@link #connect(ResponseHandler)} might never become visible to other threads. * - * @param uri The URI to set. - * @return This, to allow chaining. + * @param uri the URI to set + * @return this, to allow chaining * @see #getUri() */ public Request setUri(URI uri) { @@ -151,22 +146,22 @@ public class Request extends AbstractResource { } /** - * <p>Returns whether or not this Request was created by a {@link ServerProvider}. The value of this is used by - * {@link Container#resolveHandler(Request)} to decide whether to match against server- or client-bindings.</p> + * Returns whether or not this Request was created by a {@link ServerProvider}. The value of this is used by + * {@link Container#resolveHandler(Request)} to decide whether to match against server- or client-bindings. * - * @return True, if this is a server request. + * @return true, if this is a server request */ public boolean isServerRequest() { return serverRequest; } /** - * <p>Sets whether or not this Request was created by a {@link ServerProvider}. The constructor that accepts a + * Sets whether or not this Request was created by a {@link ServerProvider}. The constructor that accepts a * {@link CurrentContainer} sets this to <em>true</em>, whereas the constructor that accepts a parent Request sets - * this to <em>false</em>.</p> + * this to <em>false</em>. * - * @param serverRequest Whether or not this is a server request. - * @return This, to allow chaining. + * @param serverRequest whether or not this is a server request + * @return this, to allow chaining * @see #isServerRequest() */ public Request setServerRequest(boolean serverRequest) { @@ -175,13 +170,13 @@ public class Request extends AbstractResource { } /** - * <p>Returns the last resolved {@link BindingMatch}, or null if none has been resolved yet. This is set + * Returns the last resolved {@link BindingMatch}, or null if none has been resolved yet. This is set * automatically when calling the {@link Container#resolveHandler(Request)} method. The BindingMatch object holds * information about the match of this Request's {@link #getUri() URI} to the {@link UriPattern} of the resolved * {@link RequestHandler}. It allows you to reflect on the parts of the URI that were matched by wildcards in the - * UriPattern.</p> + * UriPattern. * - * @return The last resolved BindingMatch, or null. + * @return the last resolved BindingMatch, or null * @see #setBindingMatch(BindingMatch) * @see Container#resolveHandler(Request) */ diff --git a/messagebus/src/main/java/com/yahoo/messagebus/Message.java b/messagebus/src/main/java/com/yahoo/messagebus/Message.java index 43f5c8d2dfd..6848ffc55d8 100644 --- a/messagebus/src/main/java/com/yahoo/messagebus/Message.java +++ b/messagebus/src/main/java/com/yahoo/messagebus/Message.java @@ -47,21 +47,10 @@ public abstract class Message extends Routable { } } - /** - * <p>Return the route of this routable.</p> - * - * @return The route. - */ - public Route getRoute() { - return route; - } + /** Returns the route of this routable */ + public Route getRoute() { return route; } - /** - * <p>Set a new route for this routable.</p> - * - * @param route The new route. - * @return This, to allow chaining. - */ + /** Sets a new route for this routable */ public Message setRoute(Route route) { this.route = new Route(route); return this; @@ -157,11 +146,9 @@ public abstract class Message extends Routable { } /** - * <p>Returns the identifier used to order messages. Any two messages that have the same sequence id are ensured to + * Returns the identifier used to order messages. Any two messages that have the same sequence id are ensured to * arrive at the recipient in the order they were sent by the client. This value is only respected if the {@link - * #hasSequenceId()} method returns true.</p> - * - * @return The sequence identifier. + * #hasSequenceId()} method returns true. */ public long getSequenceId() { return 0; diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainer.java index 05bfac47fb9..4f7902d4dbc 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainer.java @@ -62,7 +62,7 @@ public class SpareCapacityMaintainer extends NodeRepositoryMaintainer { if (failurePath.isPresent()) { int worstCaseHostLoss = failurePath.get().hostsCausingFailure.size(); metric.set("spareHostCapacity", worstCaseHostLoss - 1, null); - if (worstCaseHostLoss <= 1) { + if (worstCaseHostLoss == 1) { // Try to get back to needing 2 hosts to fail in the worst case Optional<Node> moveCandidate = identifyMoveCandidate(failurePath.get()); if (moveCandidate.isPresent()) move(moveCandidate.get()); @@ -71,7 +71,8 @@ public class SpareCapacityMaintainer extends NodeRepositoryMaintainer { } private Optional<Node> identifyMoveCandidate(CapacityChecker.HostFailurePath failurePath) { - return Optional.empty(); + Node host = failurePath.hostsCausingFailure.get(0); + } private void move(Node node) { diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java index 8a15c058ff4..5e297900767 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java @@ -206,7 +206,7 @@ public class NodePrioritizer { builder.parent(parent).freeParentCapacity(parentCapacity); if (!isNewNode) - builder.resizable(!allocateFully + builder.resizable(! allocateFully && requestedNodes.canResize(node.flavor().resources(), parentCapacity, isTopologyChange, currentClusterSize)); if (spareHosts.contains(parent)) |