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 is a component in java?

459


What is difference between java and core?

460


Describe orm?

523


Is a relationship java?

492


What is web container in j2ee?

535






How many types of objects are there in java?

465


What is java technology stack?

489


What is callback methods?

534


What is wildfly java?

481


How does j2ee application work?

473


What is ear file?

541


What is j2ee tutorial?

504


What is java ee used for?

454


How do you run a java program?

466


What is application assembler?

522