O'Reilly logo

Java RMI by William Grosso

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Requirements for Our Naming Service

The first requirement is to be backwards-compatible with already existing naming services. The second is that future versions of the naming service can be backwards-compatible with our naming service.

Unfortunately, there isn’t really a reliable way to be backwards-compatible with the RMI registry. First, any calls to static methods on classes in the Javasoft packages are out of our control. Therefore, client code that makes calls to Naming will either communicate with an instance of the RMI registry or not work at all. Second, we will directly support concepts that just aren’t present in RMI (namely, hierarchical structures and attributes). This means that the best we can do is use the same method names (bind( ), unbind( ), etc.) to make it easier for a programmer to translate the client code.

As for the second compatibility requirement, there are a few things we can do to make it more likely. The easiest is to simply use objects for arguments. When you use objects, you make it easier to update and alter an interface. Even though a path is, for the most part, a sequence of strings, and attributes are simply name-value pairs, we actually define a class called Path and a class called AttributeSet. This means our methods look like the following bind( ) method:

public void bind(Path path, String name, AttributeSet attributes, Remote server)

This will enable us to broaden the definition of either “path” or “attribute” in future versions of the application ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required