is it possible to create single instance of java class per
session in web application

Answer Posted / savar33

Hi guys

the singleton solution will not work, since several nodes
are possible in the cluster, each node has it's own java.
Those singleton can be instanciated in each class.

Beside this the presented implementation of singleton design
pattern is improper. You should override constructor in this
way :
private Singleton(){};

I also would make getInstance() method synchronized. This is
multithreaded environment.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you understand by j2ee?

481


What is full form of j2ee?

528


What do you mean by j2ee module?

536


What are the different types of events in java?

426


What is DDP?

541






What is the container?

567


What is java full stack developer?

487


Is j2ee a programming language?

536


What is difference between java and core?

460


Why java is a platform?

464


What is a web container j2ee?

492


What is a j2ee container?

583


In DAO we are writting sql queries , how it is possible with creating and closing database connections.

1538


What does java ee stand for?

445


What is the difference between session bean and entity bean ?

483