September 2002
Intermediate to advanced
608 pages
14h 20m
English
Now we need a client that can talk to our remote object. For simplicity, we'll go back to our original Console class. The first change you'll notice is how we get a reference to the Standings object. Rather than invoking an object constructor via new(), we look up the object in the registry via a call to Naming.lookup(), using the same name string that was passed to the bind() or rebind() call. We then need to modify all of our calls to the remote class to account for the possibility that they will throw a RemoteException.
// RemoteConsole.java package nfl.presentation; import java.rmi.Naming; import java.rmi.RemoteException; import java.util.List; import java.util.Properties; import nfl.ObjectFactory; ... |
Read now
Unlock full access