This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes Is it necessary to remove any Request attributes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Is it necessary to remove any Request attributes?" Watch "Is it necessary to remove any Request attributes?" New topic
Author

Is it necessary to remove any Request attributes?

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Would it make noticeable slowdown in my application if I don't remove it? Would it add extra overhead to my app? Or is it destroyed sometime in my application? Thanks!


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61456
    
  67

Generally, don't worry about it. The request will go out of scope when the response is sent back to the client. At that time, any scoped variables (attributes) will be subject to garbage collection rules.

Because session and application scopes stay around longer, you need to be mindful of variable life-time in those scopes, but for page and request scopes, it's not usually an issue.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
Some servlet containers maintain an object pool of request objects, so the content won't be collected. However in this case servlet container has to assure that request looks like freshly created.


Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Thanks for your inputs guys
 
jQuery in Action, 2nd edition
 
subject: Is it necessary to remove any Request attributes?