Hi Vivek,

If you mean using a servlet the web app loads then yes it is not a great 
idea. The problem is that there is only one instance of a Servlet loaded 
(ignoring SingleThreadModel) so you will have to synchronize use of the 
code. This is bad. Each request that wants to use your singleton servlet 
as an 'action' (JavaBean?) will have to be processed one after the other.

Your general idea is good. To implement it best create a pooling 
mechnism for your actions. Identical to pooling database connections but 
instead pool your action classes. This way you can execute more then one 
request at a time and you'll avoid excess initializing and garbage 
collection. FYI, you should make sure your container and/or framework 
doesn't do this for your already.

Cheers,

Jayson Falkner
[EMAIL PROTECTED]

Vivek wrote:
> Can anyone suggest me are there any major drawbacks if we use class 
> object extending some *base servlet *as action handler rather than using 
> common classes.
> See this way i am saving myself from the overhead of instantiating 
> classes in my controller everytime a request is made and garbage 
> collection by the JVM ,and if suppose around thousands of hits at a time 
> could lead to memory overflow error.On the other hand a servlet 
> intialised once could be faster and efficient /easier way i suppose.
>  
> Ur comments would be acknowleged.....
> Thanks
> To change your membership options, refer to:
> http://www.sys-con.com/java/list.cfm



To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to