Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how make an object available for entire cluster?

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34671
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34671
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic