在退出之前卸载dll rxtx以避免jvm崩溃或隐藏hs_err_pid.log文件 [英] Unloading dll rxtx before exit to avoid jvm crashes or hide hs_err_pid.log files

查看:669
本文介绍了在退出之前卸载dll rxtx以避免jvm崩溃或隐藏hs_err_pid.log文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,我在一个使用rxtxSerial.dll的项目(非常漂亮的方式)。



无论如何,我在GUI上做了一个修改,使它更加用户友好,最初的程序显示主窗口,可以打开一些其他框架,用户可以监视我所在公司设计的某些设备。所以当用户想关闭漏洞程序和任何窗口,其中openend显示一个对话框,要求用户自己关闭对方的窗口,然后关闭程序,那真的很丑,所以我想:让我们做得更好;这就是我所做的:



使用串行通信的JDialog s时,我只是保存一个引用为了将来使用,如果用户提示关闭程序比退出之前,程序执行以下代码,以确保相应的监听器被调用,如从串行端口停止读取:



< pre $ for(Window w:opensWindows)
{
w.getToolkit()。getSystemEventQueue()。postEvent(
new WindowEvent(w,WindowEvent WINDOW_CLOSING));
}

当用户关闭对话框时,程序不会崩溃,实际上,在负责关闭通信的 WindowListener 中没有问题,有时当在线窗口被阻止时(在串行通信方面)提示关闭时,它会崩溃崩溃本身对于用户来说是不可见的(只要他查看程序的文件夹hs_err_pid.log文件),并在大约20%的关闭与在线窗口发生。 hs_err中的崩溃如下所示: siginfo:ExceptionCode = 0xc0000005,写入地址0x17adfa88 所以我想这是发生的是,dll尝试写入java的内存后,它已经关闭所以jvm崩溃(纠正我,如果我错了)。



我想要的是一种不生成这些错误日志文件的方法,它可以解决问题或者只是一种隐藏这些文件的方法,如果可能的话我的答案不是。



我认为可能的一个可能的修复是在关闭之前强制卸载dll下载jvm本身或请求卸载dll,等待卸载。



任何想法?



提前感谢

解决方案

解决了我从rxtx迁移到jSSC的问题: http://code.google.com/p/java-simple-serial-connector/



现在一切都很顺利!将系统自动检测的Windows,linux,mac和solaris集成到.jar中。



保存了大量的工作!



仍然没有明确的理由这些崩溃。


Well, I'm on a project that uses rxtxSerial.dll (very buggy by the way).

Anyway, I made a modification on the GUI to make it more user-friendly, initially the program shows up the main window and it's possible to open some other frames where the user can monitor certain devices designed by the company I work for. So when the user wanted to close the hole program and any windows where openend it showed up a dialog asking for the user close the oppened windows himself and then close the program, that was really ugly so I thought: let's make it better; and that's what I made:

when JDialogs that use serial communication are opened I just save a reference for it for future use if the user prompt to close the program than before exit, the program performs the following code to ensure that the respective listeners are called like stop reading from the serial port:

    for (Window w : openedWindows)
    {
        w.getToolkit().getSystemEventQueue().postEvent(
            new WindowEvent(w, WindowEvent.WINDOW_CLOSING));
    }

The program doesn't crash when the dialogs are closed by the user so there is no problem on the WindowListeners that are responsible for shuting the communication down, and sometimes it crashes when prompt to close while online windows are oppened (in serial communication aspect), actually the crash itself is not visible for the user (just if he look into program's folder the hs_err_pid.log files) and happens about 20% of the closes with online windows. The crash in hs_err are like: siginfo: ExceptionCode=0xc0000005, writing address 0x17adfa88 so what I suppose it's happening is that the dll tries to write to java's memory after it was already closed so the jvm crashes (correct me if I'm wrong).

What I want is a way to not generate those error log files, it can be made fixing the problem or just a way to hide those files, if possible that I thing the answer is not.

One of the possible fixes I thought possible is to force unload the dll before shutting down the jvm itself or "ask for" unload the dll and wait until it's unloaded.

Any ideas?

Thanks in advance.

解决方案

Solved my problem migrating from rxtx to jSSC: http://code.google.com/p/java-simple-serial-connector/

Now everything is working smooth! Integrated dlls into .jar for Windows, linux, mac and solaris with system auto-detection.

saved my a lot of work!

Still have no clear reason for those crashes.

这篇关于在退出之前卸载dll rxtx以避免jvm崩溃或隐藏hs_err_pid.log文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆