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

The Java Naming and Directory Interface (JNDI)

This chapter has been something of a mixed bag. We first discussed the general idea of a naming service. This led to a discussion of the idea of federating, and from there we implemented our own naming service. Implementing our own naming service served two purposes: it helped to make the idea that there are many different possible naming services, each with their own advantages and disadvantages, more concrete. It also served as a fully worked example of a highly threaded server; our naming service is significantly more complex that any version of Account_Impl that will appear in this book.

The final topic for this chapter is the Java Naming and Directory Interface (JNDI). JNDI consists of three things:

  • A set of fairly generic interfaces that encapsulate the common operations performed on naming services. These interfaces are defined in the javax.naming and javax.naming.directory packages and include such interfaces as Context, Attribute, and Name.

  • A generic way for client code to initialize a connection to a naming service that implements the JNDI interfaces. JNDI provides the InitialContext class, defined in the javax.naming package, to enable code to connect to a naming service. InitialContext works by using various system properties to create an instance of Context for client code.

  • A “device-driver” model for naming service providers. Client code uses the interfaces and connects to a context using InitialContext. The last remaining ...

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