Java Code Examples for io.netty.util.internal.ThrowableUtil#addSuppressed()
The following examples show how to use
io.netty.util.internal.ThrowableUtil#addSuppressed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Native.java From netty-4.1.22 with Apache License 2.0 | 6 votes |
private static void loadNativeLibrary() { String name = SystemPropertyUtil.get("os.name").toLowerCase(Locale.UK).trim(); if (!name.startsWith("mac") && !name.contains("bsd") && !name.startsWith("darwin")) { throw new IllegalStateException("Only supported on BSD"); } String staticLibName = "netty_transport_native_kqueue"; String sharedLibName = staticLibName + '_' + PlatformDependent.normalizedArch(); ClassLoader cl = PlatformDependent.getClassLoader(Native.class); try { NativeLibraryLoader.load(sharedLibName, cl); } catch (UnsatisfiedLinkError e1) { try { NativeLibraryLoader.load(staticLibName, cl); logger.debug("Failed to load {}", sharedLibName, e1); } catch (UnsatisfiedLinkError e2) { ThrowableUtil.addSuppressed(e1, e2); throw e1; } } }
Example 2
Source File: Native.java From netty-4.1.22 with Apache License 2.0 | 6 votes |
private static void loadNativeLibrary() { String name = SystemPropertyUtil.get("os.name").toLowerCase(Locale.UK).trim(); if (!name.startsWith("linux")) { throw new IllegalStateException("Only supported on Linux"); } String staticLibName = "netty_transport_native_epoll"; String sharedLibName = staticLibName + '_' + PlatformDependent.normalizedArch(); ClassLoader cl = PlatformDependent.getClassLoader(Native.class); try { NativeLibraryLoader.load(sharedLibName, cl); } catch (UnsatisfiedLinkError e1) { try { NativeLibraryLoader.load(staticLibName, cl); logger.debug("Failed to load {}", sharedLibName, e1); } catch (UnsatisfiedLinkError e2) { ThrowableUtil.addSuppressed(e1, e2); throw e1; } } }