Singleton in web applications


General J2EE: Singleton in web applications

  1. Singleton in web applications (1 messages)

    Hi, This question is to the architects. I have a web application and the flow is something like this Intercepting Filters -> Front controller -> Delegates -> Business Objects -> DAO Now in this flow, What are advantages/disadvantages if the delegate, business object and dao objects are singletons. They are singletons per functionality. I mean For all customer related functionality i have done customerdelegate, customerbo and customerdao. Your valid inputs are appreciated Thanx and Regards Kumar Related Links
  2. Re: Singleton in web applications[ Go to top ]

    Singletons are fine if your services/business objects do not contain state and do not require synchronization. If you need to maintain state in your service or business object, than probably you need to use multiple instances of an object. Make sure you clearly separate stateless services and stateful business objects in your application. This will make your decisions more obvious. Also try to avoid lazy loading if possible because it typically requires synchronization which in turn results in performance loss. Java Development on Demand