类io.netty.util.internal.OutOfDirectMemoryError源码实例Demo

下面列出了怎么用io.netty.util.internal.OutOfDirectMemoryError的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Bats   文件: FailureUtils.java
public static boolean isDirectMemoryOOM(Throwable e) {
  if (e instanceof OutOfDirectMemoryError || e instanceof OutOfMemoryException) {
    // These are always direct memory errors
    return true;
  }

  return (e instanceof OutOfMemoryError) && DIRECT_MEMORY_OOM_MESSAGE.equals(e.getMessage());
}
 
源代码2 项目: styx   文件: NettyToStyxResponsePropagatorTest.java
private OutOfDirectMemoryError newOutOfDirectMemoryError(String message) throws IllegalAccessException, InvocationTargetException, InstantiationException {
    // OutOfDirectMemoryError has a package-private constructor.
    // Use reflection to instantiate it for testing purposes.
    Constructor<OutOfDirectMemoryError> constructor = null;
    try {
        constructor = OutOfDirectMemoryError.class.getDeclaredConstructor(String.class);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
    constructor.setAccessible(true);
    return constructor.newInstance(message);
}
 
 类所在包
 同包方法