8033542: test/java/util/logging/SimpleLogManager might let Loggers be gc'ed too early
Fix another case of potentially premature Logger garbage collection in tests. Reviewed-by: mchung
This commit is contained in:
parent
8ca6ca944b
commit
11c56780a4
@ -98,16 +98,14 @@ public class SimpleLogManager extends CustomLogManager {
|
||||
return false;
|
||||
}
|
||||
CustomLogger newLogger = new CustomLogger(logger);
|
||||
super.addLogger(newLogger);
|
||||
return true;
|
||||
return super.addLogger(newLogger);
|
||||
}
|
||||
|
||||
public class CustomLogger extends Logger {
|
||||
final Logger keepRef; // keep a strong reference to avoid GC.
|
||||
CustomLogger(Logger logger) {
|
||||
super(logger.getName(), logger.getResourceBundleName());
|
||||
}
|
||||
CustomLogger(String name) {
|
||||
super(name, null);
|
||||
keepRef = logger;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user