• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help with a clustered environment

 
Steve Ford
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • 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
Marshal
Posts: 34973
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic