-
How can I control the quantities of different beans in my App? (4 messages)
- Posted by: Guotong Xie
- Posted on: June 09 2003 22:37 EDT
Too many entity beans and session beans is a threat against my J2EE App's performance. Can singleton and factory pattern work?Threaded Messages (4)
- How can I control the quantities of different beans in my App? by Raj S on June 10 2003 03:25 EDT
- How can I control the quantities of different beans in my App? by Guotong Xie on June 10 2003 04:19 EDT
- How can I control the quantities of different beans in my App? by Roman Rytov on June 10 2003 01:57 EDT
- How can I control the quantities of different beans in my App? by Guotong Xie on June 10 2003 04:19 EDT
- singleton and factory method by supraja madhavi on June 10 2003 08:10 EDT
-
How can I control the quantities of different beans in my App?[ Go to top ]
- Posted by: Raj S
- Posted on: June 10 2003 03:25 EDT
- in response to Guotong Xie
Hello Guotong,
The Best solution to this will be using Flyweight Pattern!!!! You can also use other Patterns like "Service Locator", "Factory Pattern" etc.
Raj -
How can I control the quantities of different beans in my App?[ Go to top ]
- Posted by: Guotong Xie
- Posted on: June 10 2003 04:19 EDT
- in response to Raj S
I think factory is ok.Flyweight is too complex to me,for there is no many reusable beans in my app.Service Locator?I have not heard it before.How can I find it? -
How can I control the quantities of different beans in my App?[ Go to top ]
- Posted by: Roman Rytov
- Posted on: June 10 2003 13:57 EDT
- in response to Guotong Xie
Here is a link to Alur's patterns:
http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html
I'd recommend you to pay attention to SessionFacade.
It seems to me FleighWeight is implemented by the framework itself, I mean EJB container manages lifecircle of beans.
Anyway any architecture has its limitation and one moment capacity of your server is over. To many beans even extrimly optimized is a disaster for a server. To not to come to this limit you may 1. try clustering and 2. confine number of instances of beans in the container in its settings. -
singleton and factory method[ Go to top ]
- Posted by: supraja madhavi
- Posted on: June 10 2003 08:10 EDT
- in response to Guotong Xie
"As far as my knowldger is there,number of beans in an application is reduced only through optimization in code.Here optimizations means reducing the beans by reducing the methods.Here methods can be reduced by removing methods which are related or resulting in same output.As far singleton concerned it helps in reducing instance creation. The Singleton pattern [ GHJV95 ] ensures that only a single instance of a class exists in an application. The meaning of the term "singleton" is not always clear in a distributed environment; in ServiceLocator it means that only one instance of the class exists per class loader.
The Singleton pattern improves performance because it eliminates unnecessary construction of ServiceLocator objects, JNDI InitialContext objects, and enables caching
The Web-tier service locator also improves performance by caching the objects it finds. The cache lookup ensures that a JNDI lookup only occurs once for each name. Subsequent lookups come from the cache, which is typically much faster than a JNDI lookup. And in realtion to Factory pattern This pattern helps to model an interface for creating an object which at creation time can let its subclasses decide which class to instantiate. We call this a Factory Pattern since it is responsible for "Manufacturing" an Object. It helps instantiate the appropriate Subclass by creating the right Object from a group of related classes. So It also helps upto some extent"