Welcome! I have a question regarding J2EE caching. Let's suppose I have
a data structure, somewhat complex and time-consuming to build, not persisted
in a RDBMS, that I would like to cache and expose to my EJB's. What is the
best way to accomplish this?
Some gotcha's here:
1)Because of the nature of the data structure we want to cache (memory/perf
intensive to build) it does not make a good candidate for an EJB itself,
because we do not want our EJB container creating multiple instances of this
2) Because this data structure is essentially a Singleton, how do we expose
a single-instance of this data structure to the EJB's in a *non app-server
specific* (i.e. portable manner)?
I look forward to your response!
Re: J2EE Caching
Related to this Question. I have a Controller Facade that talks to 19 other
BMP entity Beans. Whats is the best way to handle caching each of these beans
Interfaces so I don't have to keep finding by primary key or getting the
home each time. Intereset to hear you approach to this.
TRW Software Eng.
Re: J2EE Caching
A proper solution to this problem will always depend on the scale and nature
of the system in question. But I have actually been dealing with a similar
problem myself recently, so I will discuss below how I solved that, for my
In my setup, I had a cluster of servers, each running HTTP and application
servers. HTTP requests were directed to a specific server by means of a load
balancing mechanism in front of the "middle tier".
Similar to your problem, I had to access a particular data object from each
application server. This data object was designed to be a Singleton, so the
problem was how I should share the instance between different application
As a solution, I invented for each application server an event manager, that
listened after all Events that were fired for the application. When the Singleton
data object was modified on a particular server (no chance to know which
one, since the application was load-balanced), an object-modified-event was
fired, and caught by the event manager. The event manager would contact all
the other event managers through a message-driven EJB bean (if you are not
using an EJB 2.0 compliant bean container, you could simply use JMS or even
RMI). When an event manager was contacted by another event manager, he would
take appropriate action on the local data object instance, thus ensuring
integrity and portability for the whole system.
I hope you understand what I'm getting at here. Of course, there are probably
many other solutions to this problem, some of which might be more appropriate
in your situation.
Let me know what you think!
Re: J2EE Caching
I'm sorry I haven't got back to you earlier
If I'm not misunderstanding, I would think that your facade implementation
should be able to store these references in some type of collection object.
How is the facade set up? Are you performing in a clustered environment?
Please give me some more details, so that I can better visualize the scenerio.
By Duong Thanh An in forum Java
Last Post: 07-25-2002, 10:10 PM
By Mark Yadav in forum Java
Last Post: 07-04-2002, 01:32 PM
By Anthony Perritano in forum Careers
Last Post: 12-01-2001, 06:45 AM
By Rich Newbold in forum dotnet.announcements
Last Post: 05-09-2001, 06:46 PM
Last Post: 05-08-2000, 06:26 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL