本文整理匯總了Java中io.netty.util.ResourceLeakDetector.getLevel方法的典型用法代碼示例。如果您正苦於以下問題:Java ResourceLeakDetector.getLevel方法的具體用法?Java ResourceLeakDetector.getLevel怎麽用?Java ResourceLeakDetector.getLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.netty.util.ResourceLeakDetector
的用法示例。
在下文中一共展示了ResourceLeakDetector.getLevel方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toLeakAwareBuffer
import io.netty.util.ResourceLeakDetector; //導入方法依賴的package包/類
protected static ByteBuf toLeakAwareBuffer(ByteBuf buf) {
ResourceLeak leak;
switch (ResourceLeakDetector.getLevel()) {
case SIMPLE:
leak = AbstractByteBuf.leakDetector.open(buf);
if (leak != null) {
buf = new SimpleLeakAwareByteBuf(buf, leak);
}
break;
case ADVANCED:
case PARANOID:
leak = AbstractByteBuf.leakDetector.open(buf);
if (leak != null) {
buf = new AdvancedLeakAwareByteBuf(buf, leak);
}
break;
}
return buf;
}
示例2: execute
import io.netty.util.ResourceLeakDetector; //導入方法依賴的package包/類
@Override
public boolean execute(ViaCommandSender sender, String[] args) {
if (ResourceLeakDetector.getLevel() != ResourceLeakDetector.Level.ADVANCED)
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED);
else
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED);
sendMessage(sender, "&6Leak detector is now %s", (ResourceLeakDetector.getLevel() == ResourceLeakDetector.Level.ADVANCED ? "&aenabled" : "&cdisabled"));
return true;
}
示例3: toLeakAwareBuffer
import io.netty.util.ResourceLeakDetector; //導入方法依賴的package包/類
private static ByteBuf toLeakAwareBuffer(DoubleByteBuf buf) {
try {
ResourceLeakTracker<DoubleByteBuf> leak;
switch (ResourceLeakDetector.getLevel()) {
case DISABLED:
break;
case SIMPLE:
leak = leakDetector.track(buf);
if (leak != null) {
return simpleLeakAwareByteBufConstructor.newInstance(buf, leak);
}
break;
case ADVANCED:
case PARANOID:
leak = leakDetector.track(buf);
if (leak != null) {
return advancedLeakAwareByteBufConstructor.newInstance(buf, leak);
}
break;
}
return buf;
} catch (Throwable t) {
// Catch reflection exception
throw new RuntimeException(t);
}
}
示例4: setup
import io.netty.util.ResourceLeakDetector; //導入方法依賴的package包/類
@Before
public void setup() throws Exception {
originalLevel = ResourceLeakDetector.getLevel();
ResourceLeakDetector.setLevel(Level.PARANOID);
InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE);
this.serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
this.serviceBuilder.initialize();
}
示例5: setup
import io.netty.util.ResourceLeakDetector; //導入方法依賴的package包/類
@Before
public void setup() {
origionalLogLevel = ResourceLeakDetector.getLevel();
ResourceLeakDetector.setLevel(Level.PARANOID);
}