Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
 

Distributed Garbage Collection


by jGuru

[Exercise | API Docs | Short Course| Exercises]

Help is available for each task.



    Task 1

    Change the value of the constant HOST_NAME in RMIClient.java and RMIServer.java to match the name of your computer.

    Task 2

    Compile all Java source files.


    Use the javac program:

    javac *.java

    Task 3

    From the Solution subdirectory, run the server, RMIServer with the smallest heap possible.


    Start a new DOS console and go to the directory that contains the java code.

    Execute the following command: java -mx1m RMIServer This will run the Java Virtual Machine with a heap that can't grow.

    Task 4

    Run two instances of the client.


    Start two additional DOS consoles and go to the directory for the Java code.

    In each DOS console, prepare to execute the following command:

    java RMIClient

    but do not hit the enter key, just yet.

    When both consoles are ready, hit the Enter key for both so that start running at roughly the same time.

    Notice the output from the different consoles. The Server will show when it creates each object. When each MessageObject is unreferenced, it will print a message and when the local garbage collector is about to destroy each MessageObject, they will print a message.

    Notice that the local garbage collector does not destroy any objects until near the end of the run. You will also note that after the demonstration has finished it will take 10 minutes before the server complete releasing all of the objects. This shows that the lease term of the remote objects has been set to 10 minutes. Since the clients have terminated, the server will wait until the end of the lease term before it marks the objects as being 'clean'.

Copyright 1996-2000 jGuru.com. All Rights Reserved.


[ This page was updated: 11-Feb-2000 ]
Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.