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
This commit is contained in:
Eric Anderson 2023-12-12 14:49:18 -08:00
parent e562a0558b
commit 201893f5e7
1 changed files with 2 additions and 3 deletions

View File

@ -157,10 +157,9 @@ final class ManagedChannelOrphanWrapper extends ForwardingManagedChannel {
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});