Lowered the shared resource explosion detection threshold and changed the log level from warn to debug just in case it's false positive
This commit is contained in:
parent
3d355eb48a
commit
6370d06fb3
@ -89,7 +89,8 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor {
|
|||||||
private static final InternalLogger logger =
|
private static final InternalLogger logger =
|
||||||
InternalLoggerFactory.getInstance(MemoryAwareThreadPoolExecutor.class);
|
InternalLoggerFactory.getInstance(MemoryAwareThreadPoolExecutor.class);
|
||||||
|
|
||||||
private static final int MISUSE_WARNING_THRESHOLD = 1024;
|
// I'd say 64 active event thread pools are obvious misuse.
|
||||||
|
private static final int MISUSE_WARNING_THRESHOLD = 64;
|
||||||
private static final AtomicInteger activeInstances = new AtomicInteger();
|
private static final AtomicInteger activeInstances = new AtomicInteger();
|
||||||
private static final AtomicBoolean loggedMisuseWarning = new AtomicBoolean();
|
private static final AtomicBoolean loggedMisuseWarning = new AtomicBoolean();
|
||||||
|
|
||||||
@ -205,8 +206,9 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor {
|
|||||||
int activeInstances = MemoryAwareThreadPoolExecutor.activeInstances.incrementAndGet();
|
int activeInstances = MemoryAwareThreadPoolExecutor.activeInstances.incrementAndGet();
|
||||||
if (activeInstances >= MISUSE_WARNING_THRESHOLD &&
|
if (activeInstances >= MISUSE_WARNING_THRESHOLD &&
|
||||||
loggedMisuseWarning.compareAndSet(false, true)) {
|
loggedMisuseWarning.compareAndSet(false, true)) {
|
||||||
logger.warn(
|
logger.debug(
|
||||||
"There are too many active " + getClass().getSimpleName() +
|
"There are too many active " +
|
||||||
|
MemoryAwareThreadPoolExecutor.class.getSimpleName() +
|
||||||
" instances (" + activeInstances + ") - you should share " +
|
" instances (" + activeInstances + ") - you should share " +
|
||||||
"the small number of instances to avoid excessive resource " +
|
"the small number of instances to avoid excessive resource " +
|
||||||
"consumption.");
|
"consumption.");
|
||||||
|
@ -53,7 +53,8 @@ public class HashedWheelTimer implements Timer {
|
|||||||
InternalLoggerFactory.getInstance(HashedWheelTimer.class);
|
InternalLoggerFactory.getInstance(HashedWheelTimer.class);
|
||||||
private static final AtomicInteger id = new AtomicInteger();
|
private static final AtomicInteger id = new AtomicInteger();
|
||||||
|
|
||||||
private static final int MISUSE_WARNING_THRESHOLD = 1024;
|
// I'd say 64 active timer threads are obvious misuse.
|
||||||
|
private static final int MISUSE_WARNING_THRESHOLD = 64;
|
||||||
private static final AtomicInteger activeInstances = new AtomicInteger();
|
private static final AtomicInteger activeInstances = new AtomicInteger();
|
||||||
private static final AtomicBoolean loggedMisuseWarning = new AtomicBoolean();
|
private static final AtomicBoolean loggedMisuseWarning = new AtomicBoolean();
|
||||||
|
|
||||||
@ -134,11 +135,11 @@ public class HashedWheelTimer implements Timer {
|
|||||||
int activeInstances = HashedWheelTimer.activeInstances.incrementAndGet();
|
int activeInstances = HashedWheelTimer.activeInstances.incrementAndGet();
|
||||||
if (activeInstances >= MISUSE_WARNING_THRESHOLD &&
|
if (activeInstances >= MISUSE_WARNING_THRESHOLD &&
|
||||||
loggedMisuseWarning.compareAndSet(false, true)) {
|
loggedMisuseWarning.compareAndSet(false, true)) {
|
||||||
logger.warn(
|
logger.debug(
|
||||||
"There are too many active " + getClass().getSimpleName() +
|
"There are too many active " +
|
||||||
" instances (" + activeInstances + ") - you should share " +
|
HashedWheelTimer.class.getSimpleName() + " instances (" +
|
||||||
"the small number of instances to avoid excessive resource " +
|
activeInstances + ") - you should share the small number " +
|
||||||
"consumption.");
|
"of instances to avoid excessive resource consumption.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user