Initialize Recycler.INITIAL_CAPACITY before invoking InternalLogger.debug() (#10836)
Motivation: If Log4J2's `Filter` creates `Recycler.Stack` somehow, `Recycler.Stack()` will see uninitialized `Recycler.INITIAL_CAPACITY`. This has been raised originally in https://github.com/micrometer-metrics/micrometer/issues/2369. Modification: This PR changes to initialize `Recycler.INITIAL_CAPACITY` before invoking `InternalLogger.debug()` to avoid it. Result: Fixes the problem described in the "Motivation" section.
This commit is contained in:
parent
d660706588
commit
19c121ab8d
@ -86,6 +86,8 @@ public abstract class Recycler<T> {
|
||||
RATIO = max(0, SystemPropertyUtil.getInt("io.netty.recycler.ratio", 8));
|
||||
DELAYED_QUEUE_RATIO = max(0, SystemPropertyUtil.getInt("io.netty.recycler.delayedQueue.ratio", RATIO));
|
||||
|
||||
INITIAL_CAPACITY = min(DEFAULT_MAX_CAPACITY_PER_THREAD, 256);
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (DEFAULT_MAX_CAPACITY_PER_THREAD == 0) {
|
||||
logger.debug("-Dio.netty.recycler.maxCapacityPerThread: disabled");
|
||||
@ -101,8 +103,6 @@ public abstract class Recycler<T> {
|
||||
logger.debug("-Dio.netty.recycler.delayedQueue.ratio: {}", DELAYED_QUEUE_RATIO);
|
||||
}
|
||||
}
|
||||
|
||||
INITIAL_CAPACITY = min(DEFAULT_MAX_CAPACITY_PER_THREAD, 256);
|
||||
}
|
||||
|
||||
private final int maxCapacityPerThread;
|
||||
|
Loading…
Reference in New Issue
Block a user