Hi Gary,

Holding a static reference to the implementation solves the problem.

But I noticed that the object that is bound in the registry is the RemoteHostImpl
and it should be the RemoteHost stub.

Line 145: should be:

        bind(name.toString(), stub);

That is likely to solve the problem as well, because the distributed garbage
collector will correctly cause a hard reference to be retained to the implementation.

Roger


On 03/22/2019 04:05 AM, gary.ad...@oracle.com wrote:
Here's a proposed fix for the intermittent jstatd test failure.
By moving the exported object from a local method variable to a
static class variable a strong reference is held so the object
will not be garbage collected prematurely.

  Webrev: http://cr.openjdk.java.net/~gadams/8203026/webrev.00/
  Issue: https://bugs.openjdk.java.net/browse/JDK-8203026

The test is currently filed as a core-libs/java.rmi, but it probably
should be core-svc/tools with label=jstatd. It is the callers
responsibility to ensure the strong reference to prevent
the premature garbage collection, so this is a test failure
rather than a need to change the underlying rmi behavior.

Reply via email to