From fe7caef230a6359b74b8ec6bddd9557b2f83d2f2 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Tue, 12 Dec 2023 14:49:18 -0800 Subject: [PATCH] core: Improve language for leaked channel error Originally you had to confirm that awaitTermination() returned true, but that was annoying and useless, especially after calling shutdownNow(). The behavior was changed in ce2ae1fb because the awaitTermination() detection logic could prevent the channel from getting garbage collected. Fixes #10732 --- .../java/io/grpc/internal/ManagedChannelOrphanWrapper.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/io/grpc/internal/ManagedChannelOrphanWrapper.java b/core/src/main/java/io/grpc/internal/ManagedChannelOrphanWrapper.java index 32b6cc00878..eac9b64d9db 100644 --- a/core/src/main/java/io/grpc/internal/ManagedChannelOrphanWrapper.java +++ b/core/src/main/java/io/grpc/internal/ManagedChannelOrphanWrapper.java @@ -157,10 +157,9 @@ static int cleanQueue(ReferenceQueue refqueue) { Level level = Level.SEVERE; if (logger.isLoggable(level)) { String fmt = - "*~*~*~ Previous channel {0} was not shutdown properly!!! ~*~*~*" + "*~*~*~ Previous channel {0} was garbage collected without being shut down! ~*~*~*" + System.getProperty("line.separator") - + " Make sure to call shutdown()/shutdownNow() and wait " - + "until awaitTermination() returns true."; + + " Make sure to call shutdown()/shutdownNow()"; LogRecord lr = new LogRecord(level, fmt); lr.setLoggerName(logger.getName()); lr.setParameters(new Object[] {ref.channelStr});