what is singleton class? where it mainly used in the
projects?

Answer Posted / suresh jv

Singleton class is a class, it allows jvm to create only one
object.
note:
most of the people think that servlet is a singleton class.
but it is not a singleton class. Actually for each servlet
one object will be created by container.
But suppose if u want to create another object for same
servlet, that servlet allows us to create another object but
the container (server) will not allow to create second object.

When a huge amount of requests coming to servlet, some of
the servers (espcially weblogic)allows to create second
object for same servlet to handle huge amount of requests,
then how can u say servlet is a singleton class.
"The class, itself doesn't allow to create second object "
is called singleton class.

this helps a lot u.....

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Should synchronization primitives be used on bean methods?

542


Why do threads block on i/o?

671


Why use a datasource when you can directly specify a connection details? (in a J2EE application)

3437


how to use debug in my elipse to solve problems that exist in my project

1756


What is the difference between session and entity beans?

571






If your ui seems to freeze periodically, what might be a likely reason?

535


What class is the top of the awt event hierarchy?

566


why static class in java

1269


What is the difference between the session.get() method and the session.load() method?

593


what is an isolation level?

2205


Which component handles cluster communication in jboss?

616


Can I run seam outside of jboss as?

630


Why is string immutable in java?

572


Why doesn’t the focus feature on the tag work in every circumstance?

555


If we opened Windows Internet Explorer 4 times, does it starts 4 processes or 4 threads?

1728