From 5d2c85de4e5e5f9182189cb2aaf9369070f41533 Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Wed, 28 Apr 2021 15:56:45 +0200 Subject: More lazy debug log message generation --- .../MessageBusVisitorDestinationSession.java | 2 +- .../messagebus/MessageBusVisitorSession.java | 24 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'documentapi') diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorDestinationSession.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorDestinationSession.java index ae0a89664a5..521908d661c 100644 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorDestinationSession.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorDestinationSession.java @@ -56,7 +56,7 @@ public class MessageBusVisitorDestinationSession implements VisitorDestinationSe public void ack(AckToken token) { try { - log.log(Level.FINE, "Sending ack " + token.ackObject); + log.log(Level.FINE, () -> "Sending ack " + token.ackObject); session.reply((Reply) token.ackObject); } catch (Exception e) { e.printStackTrace(); diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java index 88ef67e1854..248fcf7a624 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSession.java @@ -405,7 +405,7 @@ public class MessageBusVisitorSession implements VisitorSession { synchronized (progress.getToken()) { this.startTimeNanos = clock.monotonicNanoTime(); if (progress.getIterator().isDone()) { - log.log(Level.FINE, sessionName + ": progress token indicates " + + log.log(Level.FINE, () -> sessionName + ": progress token indicates " + "session is done before it could even start; no-op"); return; } @@ -433,7 +433,7 @@ public class MessageBusVisitorSession implements VisitorSession { * successful, will be equal to newState. */ private StateDescription transitionTo(StateDescription newState) { - log.log(Level.FINE, sessionName + ": attempting transition to state " + newState); + log.log(Level.FINE, () -> sessionName + ": attempting transition to state " + newState); switch (newState.getState()) { case WORKING: assert(state.getState() == State.NOT_STARTED); @@ -450,7 +450,7 @@ public class MessageBusVisitorSession implements VisitorSession { default: com.yahoo.protect.Process.logAndDie("Invalid target transition state: " + newState); } - log.log(Level.FINE, "Session '" + sessionName + "' is now in state " + state); + log.log(Level.FINE, () -> "Session '" + sessionName + "' is now in state " + state); return state; } @@ -500,7 +500,7 @@ public class MessageBusVisitorSession implements VisitorSession { // If no cluster route has been set by user arguments, attempt to retrieve it from mbus config. if (params.getRoute() == null || !params.getRoute().hasHops()) { params.setRoute(getClusterRoute(routingTable)); - log.log(Level.FINE, "No route specified; resolved implicit " + + log.log(Level.FINE, () -> "No route specified; resolved implicit " + "storage cluster: " + params.getRoute().toString()); } } @@ -650,7 +650,7 @@ public class MessageBusVisitorSession implements VisitorSession { VisitorIterator.BucketProgress bucket = progress.getIterator().getNext(); Result result = sender.send(createMessage(bucket)); if (result.isAccepted()) { - log.log(Level.FINE, sessionName + ": sent CreateVisitor for bucket " + + log.log(Level.FINE, () -> sessionName + ": sent CreateVisitor for bucket " + bucket.getSuperbucket() + " with progress " + bucket.getProgress()); ++pendingMessageCount; } else { @@ -690,7 +690,7 @@ public class MessageBusVisitorSession implements VisitorSession { private void markSessionCompleted() { // 'done' is only ever written when token mutex is held, so safe to check // outside of completionMonitor lock. - log.log(Level.FINE, "Visitor session '" + sessionName + "' has completed"); + log.log(Level.FINE, () -> "Visitor session '" + sessionName + "' has completed"); if (params.getLocalDataHandler() != null) { params.getLocalDataHandler().onDone(); } @@ -904,7 +904,7 @@ public class MessageBusVisitorSession implements VisitorSession { progress.getIterator().update(bucket, subProgress); String message = getErrorMessage(reply.getError(0)); - log.log(Level.FINE, sessionName + ": received error reply for bucket " + + log.log(Level.FINE, () -> sessionName + ": received error reply for bucket " + bucket + " with message '" + message + "'"); if (isFatalError(reply)) { @@ -1029,7 +1029,7 @@ public class MessageBusVisitorSession implements VisitorSession { BucketId superbucket = msg.getBuckets().get(0); BucketId subBucketProgress = reply.getLastBucket(); - log.log(Level.FINE, sessionName + ": received CreateVisitorReply for bucket " + + log.log(Level.FINE, () -> sessionName + ": received CreateVisitorReply for bucket " + superbucket + " with progress " + subBucketProgress); progress.getIterator().update(superbucket, subBucketProgress); @@ -1051,7 +1051,7 @@ public class MessageBusVisitorSession implements VisitorSession { int newMaxBuckets = Math.max(Math.min((int)(params.getMaxBucketsPerVisitor() * params.getDynamicMaxBucketsIncreaseFactor()), 128), 1); params.setMaxBucketsPerVisitor(newMaxBuckets); - log.log(Level.FINE, sessionName + ": increasing max buckets per visitor to " + log.log(Level.FINE, () -> sessionName + ": increasing max buckets per visitor to " + params.getMaxBucketsPerVisitor()); } } @@ -1061,7 +1061,7 @@ public class MessageBusVisitorSession implements VisitorSession { ClusterState newState = new ClusterState(reply.getSystemState()); int stateBits = newState.getDistributionBitCount(); if (stateBits != progress.getIterator().getDistributionBitCount()) { - log.log(Level.FINE, "System state changed; now at " + + log.log(Level.FINE, () -> "System state changed; now at " + stateBits + " distribution bits"); // Update the internal state of the visitor iterator. If we're increasing // the number of distribution bits, this may lead to splitting of pending @@ -1150,7 +1150,7 @@ public class MessageBusVisitorSession implements VisitorSession { @Override public void destroy() { - log.log(Level.FINE, sessionName + ": synchronous destroy() called"); + log.log(Level.FINE, () -> sessionName + ": synchronous destroy() called"); try { synchronized (progress.getToken()) { synchronized (completionMonitor) { @@ -1178,7 +1178,7 @@ public class MessageBusVisitorSession implements VisitorSession { } catch (Exception e) { log.log(Level.SEVERE, "Caught exception destroying communication interfaces", e); } - log.log(Level.FINE, sessionName + ": synchronous destroy() done"); + log.log(Level.FINE, () -> sessionName + ": synchronous destroy() done"); } } } -- cgit v1.2.3