Legacy properties removed (#8839)
Motivation: We can remove some properties for which we introduced replacements. Modifications: io.netty.buffer.bytebuf.checkAccessible, io.netty.leakDetectionLevel, org.jboss.netty.tryUnsafe properties removed Result: Code cleanup
This commit is contained in:
parent
dcaec33a86
commit
116f72db8d
@ -46,18 +46,13 @@ import static java.util.Objects.requireNonNull;
|
||||
*/
|
||||
public abstract class AbstractByteBuf extends ByteBuf {
|
||||
private static final InternalLogger logger = InternalLoggerFactory.getInstance(AbstractByteBuf.class);
|
||||
private static final String LEGACY_PROP_CHECK_ACCESSIBLE = "io.netty.buffer.bytebuf.checkAccessible";
|
||||
private static final String PROP_CHECK_ACCESSIBLE = "io.netty.buffer.checkAccessible";
|
||||
static final boolean checkAccessible; // accessed from CompositeByteBuf
|
||||
private static final String PROP_CHECK_BOUNDS = "io.netty.buffer.checkBounds";
|
||||
private static final boolean checkBounds;
|
||||
|
||||
static {
|
||||
if (SystemPropertyUtil.contains(PROP_CHECK_ACCESSIBLE)) {
|
||||
checkAccessible = SystemPropertyUtil.getBoolean(PROP_CHECK_ACCESSIBLE, true);
|
||||
} else {
|
||||
checkAccessible = SystemPropertyUtil.getBoolean(LEGACY_PROP_CHECK_ACCESSIBLE, true);
|
||||
}
|
||||
checkAccessible = SystemPropertyUtil.getBoolean(PROP_CHECK_ACCESSIBLE, true);
|
||||
checkBounds = SystemPropertyUtil.getBoolean(PROP_CHECK_BOUNDS, true);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("-D{}: {}", PROP_CHECK_ACCESSIBLE, checkAccessible);
|
||||
|
@ -41,7 +41,6 @@ import static java.util.Objects.requireNonNull;
|
||||
|
||||
public class ResourceLeakDetector<T> {
|
||||
|
||||
private static final String PROP_LEVEL_OLD = "io.netty.leakDetectionLevel";
|
||||
private static final String PROP_LEVEL = "io.netty.leakDetection.level";
|
||||
private static final Level DEFAULT_LEVEL = Level.SIMPLE;
|
||||
|
||||
@ -101,24 +100,7 @@ public class ResourceLeakDetector<T> {
|
||||
private static final InternalLogger logger = InternalLoggerFactory.getInstance(ResourceLeakDetector.class);
|
||||
|
||||
static {
|
||||
final boolean disabled;
|
||||
if (SystemPropertyUtil.get("io.netty.noResourceLeakDetection") != null) {
|
||||
disabled = SystemPropertyUtil.getBoolean("io.netty.noResourceLeakDetection", false);
|
||||
logger.debug("-Dio.netty.noResourceLeakDetection: {}", disabled);
|
||||
logger.warn(
|
||||
"-Dio.netty.noResourceLeakDetection is deprecated. Use '-D{}={}' instead.",
|
||||
PROP_LEVEL, DEFAULT_LEVEL.name().toLowerCase());
|
||||
} else {
|
||||
disabled = false;
|
||||
}
|
||||
|
||||
Level defaultLevel = disabled? Level.DISABLED : DEFAULT_LEVEL;
|
||||
|
||||
// First read old property name
|
||||
String levelStr = SystemPropertyUtil.get(PROP_LEVEL_OLD, defaultLevel.name());
|
||||
|
||||
// If new property name is present, use it
|
||||
levelStr = SystemPropertyUtil.get(PROP_LEVEL, levelStr);
|
||||
String levelStr = SystemPropertyUtil.get(PROP_LEVEL, DEFAULT_LEVEL.name());
|
||||
Level level = Level.parseLevel(levelStr);
|
||||
|
||||
TARGET_RECORDS = SystemPropertyUtil.getInt(PROP_TARGET_RECORDS, DEFAULT_TARGET_RECORDS);
|
||||
|
@ -354,16 +354,10 @@ final class PlatformDependent0 {
|
||||
return new UnsupportedOperationException("sun.misc.Unsafe: unavailable (io.netty.noUnsafe)");
|
||||
}
|
||||
|
||||
// Legacy properties
|
||||
String unsafePropName;
|
||||
if (SystemPropertyUtil.contains("io.netty.tryUnsafe")) {
|
||||
unsafePropName = "io.netty.tryUnsafe";
|
||||
} else {
|
||||
unsafePropName = "org.jboss.netty.tryUnsafe";
|
||||
}
|
||||
boolean tryUnsafe = SystemPropertyUtil.getBoolean("io.netty.tryUnsafe", true);
|
||||
|
||||
if (!SystemPropertyUtil.getBoolean(unsafePropName, true)) {
|
||||
String msg = "sun.misc.Unsafe: unavailable (" + unsafePropName + ")";
|
||||
if (!tryUnsafe) {
|
||||
String msg = "sun.misc.Unsafe: unavailable (io.netty.tryUnsafe)";
|
||||
logger.debug(msg);
|
||||
return new UnsupportedOperationException(msg);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import java.nio.ByteOrder;
|
||||
|
||||
public class ByteBufCopyBenchmark extends AbstractMicrobenchmark {
|
||||
static {
|
||||
System.setProperty("io.netty.buffer.bytebuf.checkAccessible", "false");
|
||||
System.setProperty("io.netty.buffer.checkAccessible", "false");
|
||||
}
|
||||
|
||||
@Param({"7", "36", "128", "512" })
|
||||
|
Loading…
x
Reference in New Issue
Block a user