Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     

Java/J2EE interview questions: - Explain singleton in a clustered environment?

In clustering there are multiple J2EE containers running on multiple JVM'S as a Result maintaining singleton is possible with following steps

1) RMI singleton object is created on only one container

2) Stubs of the same are registered in the cluster by adding the same in JNDI Name tree, thus making itself available to entire cluster

The disadvantage of the above approach as follows:

1) In case the singleton has not been created then the container created one Adds the same to JNDI. If 2 container creates singletons simultaneously then there will be a problem

2) The above problem can be solved by delegating the responsibility of creating the singleton to a single container but will cause problem in case the container in consideration fails

Also see the following video on Java and J2EE Design Pattern - Value List Handler: -

Click for moreJava/J2EE Design Pattern Interview questions.


Visit for more author’s blog on Java /J2EE Design Pattern Interview questions.

Share this article   |    Print    |    Article read by 2932 times
Shivprasad Koirala
We conduct training for Java/J2EE technologies like design patterns, J2EE, Struts, Hibernate, Spring, Rich Interface etc. and likes to write articles on the same in free time.
Related Articles: No related article
Related Interview Questions: