• 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

EJB Home Factory

 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I plan to implement EJB Home Factory but this involves caching oh EJB Home.
Can anyone tell me whether JBOSS and JONAS allows stale homes ?
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. It's common practice to cache the Home interface in order to avoid the JNDI overhead, and, in fact, I'm preparing to publish something that does just that.
The downside is that if you hot-redeploy the EJB, the home interface reference will go stale unless you add logic to detect and correct that.
 
Arijit Ghosh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim. But I need something urgently... I am using Jboss. I have edited the necessary web.xml and ejb-jar.xml file.

Now the main thing ---
to write the EJBHome Factory Java file ....
Any pointers ?
 
Tim Holloway
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The way I do it is just to create a servlet that runs at server startup. In that servlet's init() method, I lookup the home interface(s) and store them into the application context.
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at Floyd's EJB Design Patterns book on http://www.theserverside.com.
The way that I've done it is simply to have a singleton class through which you can lookup and cache JNDI references. Using a singleton does mean that you may have more than one copy in a cluster, but it does mean that you can use the factory from the presentation (web) and business (ejb) tiers of your architecture.
Simon
 
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic