Skip to content

Commit

Permalink
core: Improve language for leaked channel error
Browse files Browse the repository at this point in the history
Originally you had to confirm that awaitTermination() returned true, but
that was annoying and useless, especially after calling shutdownNow().
The behavior was changed in ce2ae1f because the awaitTermination()
detection logic could prevent the channel from getting garbage
collected.

Fixes #10732
  • Loading branch information
ejona86 committed Dec 13, 2023
1 parent e562a05 commit 201893f
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,9 @@ static int cleanQueue(ReferenceQueue<ManagedChannelOrphanWrapper> 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});
Expand Down

0 comments on commit 201893f

Please sign in to comment.