• 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

help with a clustered environment

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a J2EE application which stores an object in the servlet context using set attribute. This object basically maintains a collection of objects (of a different type) in a specific order and provides access to them. The problem is that this application is now being deployed into a clustered WAS environment, and the servlet contexts will not be shared among the servers. What would be the easiest way to address this?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steve,
I'm not sure I understand the problem. Is it that the collection can be updated and they need to be synched up across clones?

If so, take a look at WebSphere's command caching.
 
Steve Ford
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help Jeanne. The problem is this. I am storing an object called SideBar in the servlet context. This Sidebar object provides access to Category objects which are stored in a tree. At runtime servlets get the SideBar object and then ask for all the Categories to be displayed. The problem occurs when a servlet updates a Category, which could change its order in the tree or other internal data. This update changes the objects in memory and writes to storage, but the updates are only updating the SideBar/Category in their own container, so the other servers get out of synch.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll need some kind of distributed cache scheme. For example, the node that does the update can broadcast a JMS message that tells the others to remove the data from the cache. The next time somebody asks for the data they can fetch it from storage and put it back in the cache. Google for "java distributed cache" for lots more info.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Stan James:
You'll need some kind of distributed cache scheme.


Command caching is IBM/WebSphere's proprietary scheme for this. It is available in WebSphere 5 and up.

Steve,
Your scenario is roughly in line with what I was thinking about. You may need to refactor the cache to be behind a java class or its own servlet rather than in the context though.
 
Steve Ford
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So would implementing command caching be less of a change than going with entity beans? Please keep in mind, that I have no experience with enterprise beans or command caching, and at this point I am looking for a reliable yet relatively easy solution. Thanks in advance.
 
You got style baby! More than this 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