This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi Vineela, one real world example would be: in one of my earlier projects,we had used the business delegate design pattern.i.e. we had used struts framework and within the action class ,we made call to the business delegate classand from the business delegate class we made the call to the session bean.
we didnt want multiple instances of the business delegate and wanted to control the instance of the Business Delegate.hence we made it a singleton class.
the flow is like this.. Jsp-->action class-->Business Delegate(Singleton)-->Session Beans-->entity bean-->Database.
hth cheers vinny m
proud Fan of European Champion CHELSEA FC
"If you don't see the bug where you're looking, perhaps you're looking in the wrong place" -James Gosling
Many services in a J2EE server are arguably instances of the singleton pattern. At any one time only one variation of a specific service will be in use by the server, but different configurations of the server will allow different choices of service. For example, there will only be one global JNDI tree to search (one in the sense that there is a unique root starting point), but the implementation of that JNDI could be something vendor-specific, an external LDAP, Active Directory, etc.