Hello, I have pulled the java.rmi.* contribution code from the Harmony SVN and was examining the test cases for the RMI DGC.Have a few questions about how the test is performed if anyone can clarify them for me.
As far as I have understood the following is how the operation is, - TestDistributedGarbageCollector.java acts as the RMI server. - It creates a RMI registry on port 1099. - Sets the Garbage collection parameters. - Creates a new echoServer. - Binds echoServer as Echo2. - Uses ProcessBuilder to launch EchoClient2 process. - Unbind's Echo2 after Thread sleep. - The RMI client Echo2 looks for Echo2 in RMI Registry. - Enters EchoTest2 after echo(String) is called on stub. - Returns the display to be shown. - Invoke's System.gc(). When the client is Garbage collected it creates a new file name "done". However some things confuse me and it would nice if you could clarify them for me. - I notice the TestDistributedGarbageCollector class has two Threads that perform sleep, what is the second sleep Thread for ? - I notice it invokes runGc() method but what does it test ? I have seen WeakReference being created and a GC call being performed but what does it test ? - Why after the second sleep Thread is a file f created ? - How does the assertTrue function of JUnit work with file f ? - How does it determine if GC has taken place ? How will it use f to determine that - If it determines that garbage collection has failed if f still exists why is f created before the assert statement ? Thanks for helping me out and I know it is quite a lot of questions but your help will benifit me greatly. Yours Sincierly, - Vikram Mohan -- www.FaeLLe.com www.VikramMohan.com
