mirror of https://github.com/grpc/grpc-java.git
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:
parent
e562a0558b
commit
201893f5e7
|
|
@ -157,10 +157,9 @@ final class ManagedChannelOrphanWrapper extends ForwardingManagedChannel {
|
||||||
Level level = Level.SEVERE;
|
Level level = Level.SEVERE;
|
||||||
if (logger.isLoggable(level)) {
|
if (logger.isLoggable(level)) {
|
||||||
String fmt =
|
String fmt =
|
||||||
"*~*~*~ Previous channel {0} was not shutdown properly!!! ~*~*~*"
|
"*~*~*~ Previous channel {0} was garbage collected without being shut down! ~*~*~*"
|
||||||
+ System.getProperty("line.separator")
|
+ System.getProperty("line.separator")
|
||||||
+ " Make sure to call shutdown()/shutdownNow() and wait "
|
+ " Make sure to call shutdown()/shutdownNow()";
|
||||||
+ "until awaitTermination() returns true.";
|
|
||||||
LogRecord lr = new LogRecord(level, fmt);
|
LogRecord lr = new LogRecord(level, fmt);
|
||||||
lr.setLoggerName(logger.getName());
|
lr.setLoggerName(logger.getName());
|
||||||
lr.setParameters(new Object[] {ref.channelStr});
|
lr.setParameters(new Object[] {ref.channelStr});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue