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 =
|
||||
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 AtomicBoolean loggedMisuseWarning = new AtomicBoolean();
|
||||
|
||||
@ -205,8 +206,9 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor {
|
||||
int activeInstances = MemoryAwareThreadPoolExecutor.activeInstances.incrementAndGet();
|
||||
if (activeInstances >= MISUSE_WARNING_THRESHOLD &&
|
||||
loggedMisuseWarning.compareAndSet(false, true)) {
|
||||
logger.warn(
|
||||
"There are too many active " + getClass().getSimpleName() +
|
||||
logger.debug(
|
||||
"There are too many active " +
|
||||
MemoryAwareThreadPoolExecutor.class.getSimpleName() +
|
||||
" instances (" + activeInstances + ") - you should share " +
|
||||
"the small number of instances to avoid excessive resource " +
|
||||
"consumption.");
|
||||
|
@ -53,7 +53,8 @@ public class HashedWheelTimer implements Timer {
|
||||
InternalLoggerFactory.getInstance(HashedWheelTimer.class);
|
||||
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 AtomicBoolean loggedMisuseWarning = new AtomicBoolean();
|
||||
|
||||
@ -134,11 +135,11 @@ public class HashedWheelTimer implements Timer {
|
||||
int activeInstances = HashedWheelTimer.activeInstances.incrementAndGet();
|
||||
if (activeInstances >= MISUSE_WARNING_THRESHOLD &&
|
||||
loggedMisuseWarning.compareAndSet(false, true)) {
|
||||
logger.warn(
|
||||
"There are too many active " + getClass().getSimpleName() +
|
||||
" instances (" + activeInstances + ") - you should share " +
|
||||
"the small number of instances to avoid excessive resource " +
|
||||
"consumption.");
|
||||
logger.debug(
|
||||
"There are too many active " +
|
||||
HashedWheelTimer.class.getSimpleName() + " instances (" +
|
||||
activeInstances + ") - you should share the small number " +
|
||||
"of instances to avoid excessive resource consumption.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user