當前位置: 首頁>>代碼示例>>Java>>正文


Java ResourceLeakDetector.getLevel方法代碼示例

本文整理匯總了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;
}
 
開發者ID:wuyinxian124,項目名稱:netty4.0.27Learn,代碼行數:20,代碼來源:AbstractByteBufAllocator.java

示例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;
}
 
開發者ID:MylesIsCool,項目名稱:ViaVersion,代碼行數:11,代碼來源:DisplayLeaksSubCmd.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:incubator-pulsar,代碼行數:28,代碼來源:DoubleByteBuf.java

示例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();
}
 
開發者ID:pravega,項目名稱:pravega,代碼行數:9,代碼來源:TransactionTest.java

示例5: setup

import io.netty.util.ResourceLeakDetector; //導入方法依賴的package包/類
@Before
public void setup() {
    origionalLogLevel = ResourceLeakDetector.getLevel();
    ResourceLeakDetector.setLevel(Level.PARANOID);
}
 
開發者ID:pravega,項目名稱:pravega,代碼行數:6,代碼來源:AppendEncodeDecodeTest.java


注:本文中的io.netty.util.ResourceLeakDetector.getLevel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。