java.lang.UnsatisfiedLinkError.initCause()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中java.lang.UnsatisfiedLinkError.initCause()方法的一些代码示例,展示了UnsatisfiedLinkError.initCause()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UnsatisfiedLinkError.initCause()方法的具体详情如下:
包路径:java.lang.UnsatisfiedLinkError
类名称:UnsatisfiedLinkError
方法名:initCause

UnsatisfiedLinkError.initCause介绍

暂无

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Ensure that <a href="http://netty.io/wiki/native-transports.html">{@code netty-transport-native-kqueue}</a> is
 * available.
 *
 * @throws UnsatisfiedLinkError if unavailable
 */
public static void ensureAvailability() {
  if (UNAVAILABILITY_CAUSE != null) {
    throw (Error) new UnsatisfiedLinkError(
        "failed to load the required native library").initCause(UNAVAILABILITY_CAUSE);
  }
}

代码示例来源:origin: redisson/redisson

/**
 * Ensure that <a href="http://netty.io/wiki/native-transports.html">{@code netty-transport-native-epoll}</a> is
 * available.
 *
 * @throws UnsatisfiedLinkError if unavailable
 */
public static void ensureAvailability() {
  if (UNAVAILABILITY_CAUSE != null) {
    throw (Error) new UnsatisfiedLinkError(
        "failed to load the required native library").initCause(UNAVAILABILITY_CAUSE);
  }
}

代码示例来源:origin: redisson/redisson

/**
 * Ensure that <a href="http://netty.io/wiki/forked-tomcat-native.html">{@code netty-tcnative}</a> and
 * its OpenSSL support are available.
 *
 * @throws UnsatisfiedLinkError if unavailable
 */
public static void ensureAvailability() {
  if (UNAVAILABILITY_CAUSE != null) {
    throw (Error) new UnsatisfiedLinkError(
        "failed to load the required native library").initCause(UNAVAILABILITY_CAUSE);
  }
}

代码示例来源:origin: wildfly/wildfly

/**
 * Ensure that <a href="http://netty.io/wiki/forked-tomcat-native.html">{@code netty-tcnative}</a> and
 * its OpenSSL support are available.
 *
 * @throws UnsatisfiedLinkError if unavailable
 */
public static void ensureAvailability() {
  if (UNAVAILABILITY_CAUSE != null) {
    throw (Error) new UnsatisfiedLinkError(
        "failed to load the required native library").initCause(UNAVAILABILITY_CAUSE);
  }
}

代码示例来源:origin: wildfly/wildfly

/**
 * Ensure that <a href="http://netty.io/wiki/native-transports.html">{@code netty-transport-native-kqueue}</a> is
 * available.
 *
 * @throws UnsatisfiedLinkError if unavailable
 */
public static void ensureAvailability() {
  if (UNAVAILABILITY_CAUSE != null) {
    throw (Error) new UnsatisfiedLinkError(
        "failed to load the required native library").initCause(UNAVAILABILITY_CAUSE);
  }
}

代码示例来源:origin: wildfly/wildfly

/**
 * Ensure that <a href="http://netty.io/wiki/native-transports.html">{@code netty-transport-native-epoll}</a> is
 * available.
 *
 * @throws UnsatisfiedLinkError if unavailable
 */
public static void ensureAvailability() {
  if (UNAVAILABILITY_CAUSE != null) {
    throw (Error) new UnsatisfiedLinkError(
        "failed to load the required native library").initCause(UNAVAILABILITY_CAUSE);
  }
}

代码示例来源:origin: io.netty/netty

/**
 * Ensure that <a href="http://netty.io/wiki/forked-tomcat-native.html">{@code netty-tcnative}</a> and
 * its OpenSSL support are available.
 *
 * @throws UnsatisfiedLinkError if unavailable
 */
public static void ensureAvailability() {
  if (UNAVAILABILITY_CAUSE != null) {
    throw (Error) new UnsatisfiedLinkError(
        "failed to load the required native library").initCause(UNAVAILABILITY_CAUSE);
  }
}

代码示例来源:origin: netty/netty

private static void loadLibraryByHelper(final Class<?> helper, final String name, final boolean absolute)
    throws UnsatisfiedLinkError {
  Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
    @Override
    public Object run() {
      try {
        // Invoke the helper to load the native library, if succeed, then the native
        // library belong to the specified ClassLoader.
        Method method = helper.getMethod("loadLibrary", String.class, boolean.class);
        method.setAccessible(true);
        return method.invoke(null, name, absolute);
      } catch (Exception e) {
        return e;
      }
    }
  });
  if (ret instanceof Throwable) {
    Throwable t = (Throwable) ret;
    assert !(t instanceof UnsatisfiedLinkError) : t + " should be a wrapper throwable";
    Throwable cause = t.getCause();
    if (cause instanceof UnsatisfiedLinkError) {
      throw (UnsatisfiedLinkError) cause;
    }
    UnsatisfiedLinkError ule = new UnsatisfiedLinkError(t.getMessage());
    ule.initCause(t);
    throw ule;
  }
}

代码示例来源:origin: redisson/redisson

private static void loadLibraryByHelper(final Class<?> helper, final String name, final boolean absolute)
    throws UnsatisfiedLinkError {
  Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
    @Override
    public Object run() {
      try {
        // Invoke the helper to load the native library, if succeed, then the native
        // library belong to the specified ClassLoader.
        Method method = helper.getMethod("loadLibrary", String.class, boolean.class);
        method.setAccessible(true);
        return method.invoke(null, name, absolute);
      } catch (Exception e) {
        return e;
      }
    }
  });
  if (ret instanceof Throwable) {
    Throwable t = (Throwable) ret;
    assert !(t instanceof UnsatisfiedLinkError) : t + " should be a wrapper throwable";
    Throwable cause = t.getCause();
    if (cause instanceof UnsatisfiedLinkError) {
      throw (UnsatisfiedLinkError) cause;
    }
    UnsatisfiedLinkError ule = new UnsatisfiedLinkError(t.getMessage());
    ule.initCause(t);
    throw ule;
  }
}

代码示例来源:origin: wildfly/wildfly

private static void loadLibraryByHelper(final Class<?> helper, final String name, final boolean absolute)
    throws UnsatisfiedLinkError {
  Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
    @Override
    public Object run() {
      try {
        // Invoke the helper to load the native library, if succeed, then the native
        // library belong to the specified ClassLoader.
        Method method = helper.getMethod("loadLibrary", String.class, boolean.class);
        method.setAccessible(true);
        return method.invoke(null, name, absolute);
      } catch (Exception e) {
        return e;
      }
    }
  });
  if (ret instanceof Throwable) {
    Throwable t = (Throwable) ret;
    assert !(t instanceof UnsatisfiedLinkError) : t + " should be a wrapper throwable";
    Throwable cause = t.getCause();
    if (cause instanceof UnsatisfiedLinkError) {
      throw (UnsatisfiedLinkError) cause;
    }
    UnsatisfiedLinkError ule = new UnsatisfiedLinkError(t.getMessage());
    ule.initCause(t);
    throw ule;
  }
}

代码示例来源:origin: netty/netty

} catch (Exception e) {
  UnsatisfiedLinkError ule = new UnsatisfiedLinkError("could not load a native library: " + name);
  ule.initCause(e);
  ThrowableUtil.addSuppressedAndClear(ule, suppressed);
  throw ule;

代码示例来源:origin: io.netty/netty

} catch (Exception e) {
  throw (UnsatisfiedLinkError) new UnsatisfiedLinkError(
      "could not load a native library: " + name).initCause(e);
} finally {
  if (in != null) {

代码示例来源:origin: redisson/redisson

} catch (Exception e) {
  UnsatisfiedLinkError ule = new UnsatisfiedLinkError("could not load a native library: " + name);
  ule.initCause(e);
  ThrowableUtil.addSuppressedAndClear(ule, suppressed);
  throw ule;

代码示例来源:origin: wildfly/wildfly

} catch (Exception e) {
  UnsatisfiedLinkError ule = new UnsatisfiedLinkError("could not load a native library: " + name);
  ule.initCause(e);
  ThrowableUtil.addSuppressedAndClear(ule, suppressed);
  throw ule;

代码示例来源:origin: bytedeco/javacpp

loadedLibraries.remove(libnameversion2);
if (loadError != null && e.getCause() == null) {
  e.initCause(loadError);

代码示例来源:origin: bytedeco/javacpp

e.initCause(preloadError);

代码示例来源:origin: io.netty/netty-handler

/**
 * Ensure that <a href="http://netty.io/wiki/forked-tomcat-native.html">{@code netty-tcnative}</a> and
 * its OpenSSL support are available.
 *
 * @throws UnsatisfiedLinkError if unavailable
 */
public static void ensureAvailability() {
  if (UNAVAILABILITY_CAUSE != null) {
    throw (Error) new UnsatisfiedLinkError(
        "failed to load the required native library").initCause(UNAVAILABILITY_CAUSE);
  }
}

代码示例来源:origin: io.netty/netty-common

private static void loadLibraryByHelper(final Class<?> helper, final String name, final boolean absolute)
    throws UnsatisfiedLinkError {
  Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
    @Override
    public Object run() {
      try {
        // Invoke the helper to load the native library, if succeed, then the native
        // library belong to the specified ClassLoader.
        Method method = helper.getMethod("loadLibrary", String.class, boolean.class);
        method.setAccessible(true);
        return method.invoke(null, name, absolute);
      } catch (Exception e) {
        return e;
      }
    }
  });
  if (ret instanceof Throwable) {
    Throwable t = (Throwable) ret;
    assert !(t instanceof UnsatisfiedLinkError) : t + " should be a wrapper throwable";
    Throwable cause = t.getCause();
    if (cause instanceof UnsatisfiedLinkError) {
      throw (UnsatisfiedLinkError) cause;
    }
    UnsatisfiedLinkError ule = new UnsatisfiedLinkError(t.getMessage());
    ule.initCause(t);
    throw ule;
  }
}

代码示例来源:origin: io.netty/netty-common

} catch (Exception e) {
  UnsatisfiedLinkError ule = new UnsatisfiedLinkError("could not load a native library: " + name);
  ule.initCause(e);
  ThrowableUtil.addSuppressedAndClear(ule, suppressed);
  throw ule;

代码示例来源:origin: apache/activemq-artemis

/**
 * Ensure that <a href="http://netty.io/wiki/forked-tomcat-native.html">{@code netty-tcnative}</a> and
 * its OpenSSL support are available.
 *
 * @throws UnsatisfiedLinkError if unavailable
 */
public static void ensureAvailability() {
  if (UNAVAILABILITY_CAUSE != null) {
    throw (Error) new UnsatisfiedLinkError(
        "failed to load the required native library").initCause(UNAVAILABILITY_CAUSE);
  }
}

相关文章