• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

question about clustered servers

 
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When a j2ee .ear is deployed to clustered servers,

1) does each node in the cluster get one copy of .ear ?
2) if the .ear has a singleton pattern class, does each node get one class loaded separately ? or do they share one class in JVM ? I guess they can't share as each node in the cluster must have a separate JVM, right ?
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to EJB , but here is what I think about this.

regarding 1> Each of the nodes in the cluster would have a .ear deployed.

regarding 2> I think Singleton can be used , but all the jvm instances/nodes would have one object of the singleton.But it would be better to bind the object to JNDI.I do not know whether its possible or not.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Singletons dont work in a cluster. For that matter, even within a single JVM you can end up with multiple instances of a singleton (which is a totally different topic). There have been several discussions on how to workaround the "singleton in a cluster" issue. Some of the application servers have proprietary solution to this. At present, i am not able to find a similar discussion on this specific question. Will post it once i get it.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jaikiran Pai:
At present, i am not able to find a similar discussion on this specific question. Will post it once i get it.



This is the one.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jaikiran Pai:
Singletons dont work in a cluster. For that matter, even within a single JVM you can end up with multiple instances of a singleton (which is a totally different topic). There have been several discussions on how to workaround the "singleton in a cluster" issue. Some of the application servers have proprietary solution to this. At present, i am not able to find a similar discussion on this specific question. Will post it once i get it.



I understand that classloader hierarchy may lead to multiple object of the singleton per jvm.But binding it to a JNDI may be a good idea.Basically singleton has stuffs that can be shared by all the requests , so instead of creating multiple instances we have only one instance to serve all the clients.
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic