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
d2e16fb621
commit
37267f95ce
@ -89,6 +89,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");
|
||||
@ -104,8 +106,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