Java RMI在使用AdoptJDK Openj9 JVM时是否不按传统方式工作?

huangapple go评论64阅读模式
英文:

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();
   &lt;&lt;MyClassStub&gt;&gt;stub = &lt;&lt;MyClassStub&gt;&gt; UnicastRemoteObject.exportObject(myServerInstance, 9002);
            registry.rebind(&quot;RMIServer&quot;, 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

huangapple
  • 本文由 发表于 2020年8月28日 21:24:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/63634650.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定