• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Local and Remote homes

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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(...).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic