• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Local and Remote homes

 
Viktor Sadovnikov
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am a bit lost here. "You can have both a Remote and local client view for a bean". To get a reference to a home clients does something like and than has to either narrow-cast or cast to EJBHome or EJBLocalHome. How does container know what type of home the client needs?
Thanks
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container doesn't know, but the client *does* know if it is a local or remote client. You would have the local home bound to one JNDI name, and the remote client bound to another name. The client then uses the JNDI name that will get it an appropriate home.
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A couple of other things to keep in mind:
- You don't generally access local interfaces via JNDI in the way you've shown. You usually get them via the environment naming context (what HFE calls 'the bean's special JNDI context'.
- You can cast a local interface via a simple Java cast. Remote interfaces obtained via JNDI or from a handle need to be narrowed, i.e. PortableRemoteObject.narrow(...).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic