• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

best way to share a singleton across webapps in one ear?

 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all, I'm working on a project that has multiple webapps and I'd like to share a singleton across classloaders to all wars in the ear. What is the best way to go about doing this in websphere or in general?
Thanks
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read this month's JavaRanch Journal article on the "Distributed Cache Pattern".
Kyle
 
Andre Tow
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, good stuff if your clustered, but isnt JMS overkill in a single server app? Any suggestions for a lighter weight alternative?
Thanks,
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah -- Sorry, I never think about non-clustered applications because nearly every application ends up being clustered at some point.
The easiest thing might be to use the ServletContext of one of the web apps. I seem to remember from the API that if you get your ServletContext within any Servlet, and then use "getServletContext(String uri)" with the URI root of another Web App that you can retrieve that Web App's servlet context.
Kyle
 
Anderson gave himself the promotion. So I gave myself this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic