Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it necessary to remove any Request attributes?

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
dema rogatkin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your inputs guys
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic