| Author |
is Action Servlet is designed as a Singleton class ?why?
|
Shiva Shankar
Ranch Hand
Joined: Dec 07, 2006
Posts: 31
|
|
Hi, Please answer this very urgent. is Action Servlet is designed as a Singleton class ?if so why? Thanks in advance.......
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
Yes, the ActionServlet class is a singleton in the sense that there's only one per JVM. Why? Because the J2EE specification mandates that every servlet needs to work this way. It's a question of efficiency and memory conservancy. why have dozens or hundreds of instances of the same class in memory that all do the same thing? Because of this, all servlets must be coded as "thread-safe". In a Struts application, not only is the ActionServlet a singleton, but also all your Action classes as well. You must code these classes as thread-safe also.
|
Merrill
Consultant, Sima Solutions
|
 |
 |
|
|
subject: is Action Servlet is designed as a Singleton class ?why?
|
|
|