Renamed the system property for NIO constraintLevel

Simpler log message
This commit is contained in:
Trustin Lee 2010-02-18 02:23:51 +00:00
parent a58c7c4364
commit 3ae533815c
2 changed files with 18 additions and 8 deletions

View File

@ -43,7 +43,7 @@ final class DirectBufferPool {
val = 128 * 1024; val = 128 * 1024;
} else { } else {
logger.debug( logger.debug(
"Using the specified preallocated buffer capacity: " + val); "Setting the preallocated buffer capacity to: " + val);
} }
CAPACITY = val; CAPACITY = val;

View File

@ -48,6 +48,9 @@ class NioProviderMetadata {
InternalLoggerFactory.getInstance(NioProviderMetadata.class); InternalLoggerFactory.getInstance(NioProviderMetadata.class);
private static final String CONSTRAINT_LEVEL_PROPERTY = private static final String CONSTRAINT_LEVEL_PROPERTY =
"org.jboss.netty.channel.socket.nio.constraintLevel";
private static final String OLD_CONSTRAINT_LEVEL_PROPERTY =
"java.nio.channels.spi.constraintLevel"; "java.nio.channels.spi.constraintLevel";
/** /**
@ -61,17 +64,24 @@ class NioProviderMetadata {
int constraintLevel = -1; int constraintLevel = -1;
// Use the system property if possible. // Use the system property if possible.
try { constraintLevel = SystemPropertyUtil.get(CONSTRAINT_LEVEL_PROPERTY, -1);
constraintLevel = SystemPropertyUtil.get(CONSTRAINT_LEVEL_PROPERTY, -1); if (constraintLevel < 0 || constraintLevel > 2) {
// Try the old property.
constraintLevel = SystemPropertyUtil.get(OLD_CONSTRAINT_LEVEL_PROPERTY, -1);
if (constraintLevel < 0 || constraintLevel > 2) { if (constraintLevel < 0 || constraintLevel > 2) {
constraintLevel = -1; constraintLevel = -1;
} else { } else {
logger.debug( logger.warn(
"Using the specified NIO constraint level: " + "System property '" +
constraintLevel); OLD_CONSTRAINT_LEVEL_PROPERTY +
"' has been deprecated. Use '" +
CONSTRAINT_LEVEL_PROPERTY + "' instead.");
} }
} catch (Exception e) { }
// format error
if (constraintLevel >= 0) {
logger.debug(
"Setting the NIO constraint level to: " + constraintLevel);
} }
if (constraintLevel < 0) { if (constraintLevel < 0) {