抗崩溃的Java IPC
我有一个 Java 程序,它依赖于一个随机崩溃的本机库(因此导致整个 JVM 崩溃)。 该库与 I/O 相关,因此可以使用第二个 JVM 轻松地与程序的其余部分隔离。 我想将程序分成两部分,以便主程序继续运行,但本机库可以在崩溃后重新启动。问题是:让这两个 JVM 进行通信的最佳方式是什么?其中一个将崩溃并重新启动,但这不会影响另一个 JVM(除了由于崩溃和重新启动而导致 I/O 超时)。 RMI 是否具有抗崩溃能力?我应该使用套接字吗?内存映射文件?
I have a Java program which depends on a native library that crashes randomly (and therefore bring down the whole JVM).
This library is about I/O, therefore can be easily isolated from the rest of the program with a second JVM.
I want to split the program in two so that the main program keeps running, but the native library can be restarted after crash. The question is: what is the best way to let these 2 JVM communicate? One of them will crash and be restarted but this should not affect the other JVM (besides some timeout with the I/O because of the crash and restart).
Is RMI crash resistant? Should I use a socket? A memory-mapped file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将在进程之间使用持久 JMS 队列。这将是最耐碰撞的。 (修复库是最好的选择)
I would use a persistent JMS Queue between the processes. This will be the most crash resistent. (Fixing the library is the best option)