简体   繁体   English

可以将Java RMI远程对象垃圾收集到次要收集中吗?

[英]Can Java RMI remote objects be garbage-collected in a minor collection?

It is well known that RMI periodically calls System.gc() in order to cause a full gc, which will make sure that any unreferenced remote objects are collected. 众所周知,RMI会定期调用System.gc()来产生完整的gc,这将确保收集到所有未引用的远程对象。 However, I have not been able to find out whether remote objects may sometimes be garbage-collected in a minor collection. 但是,我无法确定是否有时会将远程对象垃圾收集到次要收集中。 For example, if the RMI communication is extremely low-latency and the client lease period accordingly extremely short. 例如,如果RMI通信的等待时间极短,并且客户端的租用期相应地非常短。 Or is a full gc always required? 还是始终需要完整的gc? If so, why? 如果是这样,为什么? Are remote objects perhaps not even created in Eden space, but immediately enter the tenured generation? 远程对象是否可能甚至不在伊甸园空间中创建,而是立即进入终身制?

Yes. 是。 Remote objects are no different from any other objects for the purposes of garbage collection. 出于垃圾收集的目的,远程对象与任何其他对象没有什么不同。

The DGC protocol is merely imposed on top of GC, by holding references until the DGC leases expire. DGC协议仅通过保留引用直到DGC租约到期而强加在GC之上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM