what happens if we wont use destroy()?

Answers were Sorted based on User's Feedback



what happens if we wont use destroy()?..

Answer / rv.nandakishore

Think, if there is 100's of objects are utilizing the
resource(i.e Connection object). That means allocation of
those objects are stored in the internal memory of the JVM
right... If similar requests are utilizing the Connection
object.... at one time the JVM utilization memory is full...
this will degrade the application. For this reason we call
explicitly destroy()...... if not the Garbage Collector will
taken care to reclaim the memory.... by we don's say when it
will be reclaim the memory and free the JVM memory......

Is This Answer Correct ?    20 Yes 0 No

what happens if we wont use destroy()?..

Answer / venkatesh k

destroy() is not realted to garbage collection. As per
servlet life cycle destroy method is one of compulsary
method.it is automatically invoked by Container.Internallly
we may use garbage collection means reclaim the memory.

Is This Answer Correct ?    3 Yes 1 No

what happens if we wont use destroy()?..

Answer / aru

forward is server side redirect and sendRedirect is client
side redirect. When you invoke a forward request, the
request is sent to another resource on the server, without
the client being informed that a different resource is going
to process the request. This process occurs completely with
in the web container And then returns to the calling method.
When a sendRedirect method is invoked, it causes the web
container to return to the browser indicating that a new URL
should be requested. Because the browser issues a completely
new request any object that are stored as request attributes
before the redirect occurs will be lost. This extra round
trip a redirect is slower than forward. Client can disable
sendRedirect.

Is This Answer Correct ?    2 Yes 0 No

what happens if we wont use destroy()?..

Answer / qim2010

The destroy() method and other servlet lifecycle methods are called by the servlet container, so it would be a serious error if the servlet container did not call the destroy() method as it takes a servlet out of service. Normally your application code should not call servlet lifecycle methods. It is not advisable for your application code to call the destroy() method directly, it would be confusing and potentially destructive, so it is not a problem if your application does not call the method at all.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Servlets Interview Questions

What is session tracking?

0 Answers  


Can we use javascript in Servlets?

2 Answers   Wipro,


What is string tokenizer?

0 Answers  


how to link html file to sevlet file.one name is textbox,c&c++ is cheakbox,bc&mca is radio button and one submit buttonis ok why in this programme use in servelt file

0 Answers  


What methodology can be followed to store more number of objects in a remote server?

0 Answers  






Which application server is best for java?

0 Answers  


Difference Between Web Server and Application server ??

4 Answers   PWC,


What is the dispatcher servlet?

0 Answers  


Explain the difference between generic servlet and http servlet?

0 Answers  


Hi guys.. Well can u tell me that why there is need of "init()" , i mean why can not we initialize the servlet object with the help of constructors? Thank you.

7 Answers  


which type of data passing is used in realtime?

1 Answers  


explain the advantages of servlet life cycle?

0 Answers  


Categories