英文:
Is Java RMI doesnt work traditional way with AdoptJDK Openj9 JVM?
问题
我正尝试使用AdoptOpenJDK的OpenJ9 JVM启动一个简单的RMI服务器,但程序会在没有错误/异常的情况下退出,并且RMI服务器不会启动。
完全相同的程序在AdoptOpenJDK的HotSpot JVM和其他Oracle变体中运行正常。
示例代码:
Registry registry = LocateRegistry.createRegistry(9002);
RMIServer myServerInstance = new RMIServer();
<<MyClassStub>> stub = <<MyClassStub>> UnicastRemoteObject.exportObject(myServerInstance, 9002);
registry.rebind("RMIServer", stub);
英文:
I am trying to start a simple RMI server with AdoptOpenJDK's OpenJ9 JVM but, the program exits with no error/exception and the RMI server doesn't start.
Exact same program works with AdoptOpenJDK's HotSpot JVM and other oracle variants.
Sample code:
Registry registry = LocateRegistry.createRegistry(9002);
RMIServer myServerInstance = new RMIServer();
<<MyClassStub>>stub = <<MyClassStub>> UnicastRemoteObject.exportObject(myServerInstance, 9002);
registry.rebind("RMIServer", stub);
答案1
得分: 0
OpenJ9开源社区的贡献者确认这是OpenJ9的真正问题。
在创建新服务器后,OpenJ9似乎会立即丢弃它。
当调用UnicastRemoteObject.exportObject
时,会创建一个WeakReference,并在回收器中将其注册到ReferenceQueue中。当要销毁导出的对象时,回收器会检查是否没有更多的导出对象需要跟踪,然后回收器线程将自行终止,如果没有其他线程保持虚拟机活动,则会终止虚拟机。
预计此问题将在-Release 0.24(Java 8、11、15)1月更新中得到解决,Release 0.25(Java 16)。
注意:要获取最新更新,请关注
https://github.com/eclipse/openj9/issues/10503
英文:
OpenJ9 open source community contributors confirm that it’s the real issue with OpenJ9.
OpenJ9 seems to immediately discard the new server after creating it.
When UnicastRemoteObject.exportObject
is called, a WeakReference is created and registered to the ReferenceQueue in the reaper. When the exported object is to be destroyed, the reaper checks if there are no more exported objects left to keep track of, then the reaper thread will kill itself, and the VM if there are no other threads keeping it alive.
Expected this issue to be fixed for -Release 0.24 (Java 8, 11, 15) Jan refresh, Release 0.25 (Java 16)
Note: For the latest updates keep an eye on
https://github.com/eclipse/openj9/issues/10503
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论