More brief somaxconn logging

- Consistent log message format
- Avoid unnecessary autoboxing when debug level is off
- Remove the duplication of somaxconn path
This commit is contained in:
Trustin Lee 2014-08-04 10:25:11 -07:00
parent d9cccccbb3
commit 021ecd45c3

View File

@ -187,9 +187,11 @@ public final class NetUtil {
try { try {
in = new BufferedReader(new FileReader(file)); in = new BufferedReader(new FileReader(file));
somaxconn = Integer.parseInt(in.readLine()); somaxconn = Integer.parseInt(in.readLine());
logger.debug("/proc/sys/net/core/somaxconn: {}", somaxconn); if (logger.isDebugEnabled()) {
logger.debug("{}: {}", file, somaxconn);
}
} catch (Exception e) { } catch (Exception e) {
logger.debug("Failed to get SOMAXCONN", e); logger.debug("Failed to get SOMAXCONN from: {}", file, e);
} finally { } finally {
if (in != null) { if (in != null) {
try { try {
@ -200,7 +202,9 @@ public final class NetUtil {
} }
} }
} else { } else {
logger.debug("/proc/sys/net/core/somaxconn not exists. Use default-value: {}", somaxconn); if (logger.isDebugEnabled()) {
logger.debug("{}: {} (non-existent)", file, somaxconn);
}
} }
SOMAXCONN = somaxconn; SOMAXCONN = somaxconn;