my dog learned polymorphism*
The moose likes EJB and other Java EE Technologies and the fly likes how make an object available for entire cluster? 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 "how make an object available for entire cluster?" Watch "how make an object available for entire cluster?" New topic
Author

how make an object available for entire cluster?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 550
Hi
Thank you for reading my post
I can not understand how we can make an object( cache manager for example) available for all nodes in a cluster?

I think that the cache manager should be singletone but i can not understand when and how we should create it, wether we should store it inoto the jndi to make it available for all nodes?

thanks
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29261
    
140

Raminaa,
Most of the time, people use a singleton per JVM or resources managed by the server (like datasources.) If you have a true requirement for an object across the cluster, you are correct that you would need the JNDI.


[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
raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 550
Thank you Jeanne,
Indeed what i want to share in all cluster is a cache manager.
By what i read in web pages, if we want to share someting between all nodes in cluster we should put it into the JNDI (the JNDI allways is replicated between all server instance).
Is the above statement corrent?

If it is corrent and we should put the cache manager into the JNDI, then we should initiate the cache manager ?
should we use a servlet that initialize when application start to initialize the cache manager, if i do this then all instance will do the same and we will have more than one cache manager?

thanks
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

To add to the response and give some other possible places for making an object available for an entire cluster.

So in Web an HTTP Session can be replicated, in EJB a Stateful Sesion Bean can be replicated.

Also, if you have a Cache like EHCache, JBoss Cache, or some other third party Cache API, you can put things in those too.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29261
    
140

Raminaa,
I haven't heard of people commonly using the JNDI as a cache. Note that WebLogic recommends against this practice. So you will need to read your application server documentation to make sure the replication works as you would require.

Assuming your server provides unique objects: A servlet is fine to put an object in the JNDI. You can check whether the object is already bound to avoid multiple copies.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how make an object available for entire cluster?
 
Similar Threads
Dynamic cache implementation
JNDI nameservive as a temporary storage in cluster
Vertical Scalability - Decreases: Reliability, Availability
Objects in HttpSession
Possible to clear or disable JBoss3/EJB2 cache?