Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

jGuru: Serializing Remote Objects: Server

 


[Help | API Docs | Short Course| Exercises]

In this exercise you will run the Server Side of an RMI demonstration All of the files have been created for you.

In this exercise you will see how to use the Delegation Pattern to allow a service to migrate. This is covered in the Serializing Remote Objects section of the course notes.

Skeleton Code

RemoteModelMgr.java
RemoteModelMgrImpl.java
RemoteModelImpl.java
LocalRemoteServer.java
LocalModel.java
RemoteModelRef.java

Tasks

1. Compile all of the class files for the server.

2. Create the stub and skeleton files for the remote object implementation.

3. Run the RMI server program.

Where help exists, the task numbers above are linked to the step-by-step help page.

When you finish with this exercise, go on to the next one to finish this project.

Solution Source

RemoteModelMgr.java
RemoteModelMgrImpl.java
RemoteModelImpl.java
LocalRemoteServer.java
LocalModel.java
RemoteModelRef.java

Demonstration

When the server is run in its DOS console, the output will be:

Registry created on host computer ROSA on port 10009 RemoteModelImpl object created Bindings Finished, waiting for client requests.

After the client program has been run, you will notice the following output that follows:

RemoteModelImpl...Constructor finished LocalModel...Returning: Version 1.0 RemoteModelImpl...Returning delegated VersionNumber: Version 1.0 LocalModel...Returning: Version 1.0 RemoteModelImpl...Returning delegated VersionNumber: Version 1.0

Next Magercise



Exercises



Short Course



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