本文整理了Java中com.sun.jna.Native.unregister()
方法的一些代码示例,展示了Native.unregister()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Native.unregister()
方法的具体详情如下:
包路径:com.sun.jna.Native
类名称:Native
方法名:unregister
[英]Remove all native mappings for the calling class. Should only be called if the class is no longer referenced and about to be garbage collected.
[中]删除调用类的所有本机映射。仅当类不再被引用且即将被垃圾收集时才应调用。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Init the native binding to the underlying system library.
* @return <code>true</code> if the link is effective and <code>false</code> otherwise.
*/
public static void init() throws UnsatisfiedLinkError {
Native.unregister(JOpenVRLibrary.class);
String path = System.getProperty(JNA_OPENVR_LIBRARY_PATH);
if (path != null){
JNA_LIBRARY_NAME = path;
logger.config("Using OpenVR implementation located at "+JNA_LIBRARY_NAME);
JNA_NATIVE_LIB = NativeLibrary.getInstance(JOpenVRLibrary.JNA_LIBRARY_NAME);
Native.register(JOpenVRLibrary.class, JOpenVRLibrary.JNA_NATIVE_LIB);
} else {
JNA_LIBRARY_NAME = "openvr_api";
logger.config("Using embedded OpenVR implementation "+JOpenVRLibrary.JNA_LIBRARY_NAME);
JNA_NATIVE_LIB = NativeLibrary.getInstance(JOpenVRLibrary.JNA_LIBRARY_NAME);
Native.register(JOpenVRLibrary.class, JOpenVRLibrary.JNA_NATIVE_LIB);
}
}
代码示例来源:origin: net.java.dev.jna/jna
private static void unregisterAll() {
synchronized(registeredClasses) {
for (Map.Entry<Class<?>, long[]> e : registeredClasses.entrySet()) {
unregister(e.getKey(), e.getValue());
}
registeredClasses.clear();
}
}
代码示例来源:origin: net.java.dev.jna/jna
/** Remove all native mappings for the given class.
Should only be called if the class is no longer referenced and about
to be garbage collected.
*/
public static void unregister(Class<?> cls) {
synchronized(registeredClasses) {
long[] handles = registeredClasses.get(cls);
if (handles != null) {
unregister(cls, handles);
registeredClasses.remove(cls);
registeredLibraries.remove(cls);
}
}
}
代码示例来源:origin: net.java.dev.jna/jna
/** Remove all native mappings for the calling class.
Should only be called if the class is no longer referenced and about
to be garbage collected.
*/
public static void unregister() {
unregister(findDirectMappedClass(getCallingClass()));
}
代码示例来源:origin: org.elasticsearch/jna
private static void unregisterAll() {
synchronized(registeredClasses) {
for (Map.Entry<Class<?>, long[]> e : registeredClasses.entrySet()) {
unregister(e.getKey(), e.getValue());
}
registeredClasses.clear();
}
}
代码示例来源:origin: org.elasticsearch/jna
/** Remove all native mappings for the given class.
Should only be called if the class is no longer referenced and about
to be garbage collected.
*/
public static void unregister(Class<?> cls) {
synchronized(registeredClasses) {
long[] handles = registeredClasses.get(cls);
if (handles != null) {
unregister(cls, handles);
registeredClasses.remove(cls);
registeredLibraries.remove(cls);
}
}
}
代码示例来源:origin: org.elasticsearch/jna
/** Remove all native mappings for the calling class.
Should only be called if the class is no longer referenced and about
to be garbage collected.
*/
public static void unregister() {
unregister(findDirectMappedClass(getCallingClass()));
}
内容来源于网络,如有侵权,请联系作者删除!