aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes help with a clustered environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "help with a clustered environment" Watch "help with a clustered environment" New topic
Author

help with a clustered environment

Steve Ford
Greenhorn

Joined: Apr 19, 2004
Posts: 20
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Steve Ford
Greenhorn

Joined: Apr 19, 2004
Posts: 20
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

Joined: Jan 29, 2003
Posts: 8791
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.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

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

Joined: Apr 19, 2004
Posts: 20
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.
 
Don't get me started about those stupid light bulbs.
 
subject: help with a clustered environment