Location Transperency


EJB programming & troubleshooting: Location Transperency

  1. Location Transperency (2 messages)

      I am a bit confused with the term "Location Transparency".
    The definition states that "the client code is unaware of whether the EJB object it is using is located on a machine next door or a machine across the internet."

    This just talks about the EJB object, but what about the EJBHome object. For the EJBHome object we do make a JNDI lookup wherein we specify the machine (location), along with certain other parameters.

    So the client does indeed know about the location.

    Threaded Messages (2)

  2. Location Transperency[ Go to top ]

    The JNDI lookup returns a reference to the home object, not the home object itself. The reference encapsulates the location (ip, port etc.) of the object. The returned reference is most likely a stringified-IOR, a hex dump of the variable length structure keeping the object location.

    It is like calling someone whose phone number you don't remember: you first dial a service number to connect to an operator who gives you the area code and the phone number for that person (JNDI lookup), then you dial the area code and the phone number to connect to the person (narrow).

    The client does not know where the object is, but it knows the location of a directory service where the location of the object may be found.
  3. Location Transperency[ Go to top ]

    The answer is there in your question itself. In order to access a home object, you always do a JNDI lookup. The JNDI lookup machanism hides the location of the home object. If the location of the EJBHome object gets changed, it need to get updated in the JNDI tree and the client program is not affected atall. Hence the term "Location Transparency" sounds valid. Note the client needs to know the location of the JNDI tree, but not the location of the remote object.