harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Markov" <mikhail.a.mar...@gmail.com>
Subject Re: Java Distributed Garbage Collection in RMI
Date Wed, 23 Aug 2006 15:37:23 GMT
Hi Vikram,

First of all, what rmi module are you using: rmi or rmi2? rmi module does
not support sun.* properties. Instead it supports a parallel structure of
harmony.* ones.

About your question about DGC (i'll use rmi module as an example):
Remote object (on server side!) could be collected if all the conditions
below are met:
1) (Of course) no hard references in local VM
2) no remote references from from other VMs
3) no in-progress remoted calls

Here is one of the simplest test scenarious showing how to check these
conditions:

- run rmi-registry in separate VM
- export remote object, register it in the registry and remove hard
references to this object
- kill rmi-registry VM
- wait for a period of time longer than the one specified by "
java.rmi.dgc.leaseValue" property (the default is 10 min)
- if remote object implements Unreferenced then it's unreferenced() method
should be called here
- run GC - the object should be collected and it's finalize() method should
be called

I think your code is doing a lot of extra staff so i've modified it to
implement this test scenarious (see attachment).
I did not use ProcessBuilder class as Harmony does not have it yet. The
output of the test is also attached.

Hope this helps.

Regards, Mikhail
Intel MIddleware Products Division



>  > Been experimenting with the DGC interface of Java RMI and as far as I
> have understood there is no way to make a remote object be garbage collected
> other than invoke System.gc() and let it be collected over time.
> >
> > I however notice that the internal calls can be tracked by setting the
> following system properties,
> >
> >         System.setProperty("java.rmi.server.logCalls", "true");
> >         System.setProperty ("sun.rmi.dgc.logLevel", "VERBOSE");
> >         System.setProperty("sun.rmi.dgc.logCalls", "true");
> >
> > What I was wondering is if you had any suggestions on how to actually
> ensure that the remote object has been collected. I tried placing
> System.out.println() statements in the finalize() and unreferenced()
> methods (the client also implements the Unreferenced interface) however it
> seems to generate no such output.
> >
> > Neither do the internal rmi logs that should be displayed in output in
> verbose mode show any indication of this happening.
> >
> > I have attached the code if you would be willing to examine it and let
> me know what I am not doing correctly. Ps. I have included them in zip
> format and as Java sources whichever is convinient for you.
> >
> > TestDistributedGarbageCollection.java is the RMI server and the
> EchoClient.java is the RMI client.
> >
> > Regards,
> >
> > - Vikram Mohan
>

Mime
View raw message