• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Binding user objects to request,session,pagecontext, application

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are user objects bound to the request, session, pagecontext, application objects of a JSP stored in the Java heap? The servlet API offers some control over session bound objects why is there no control provided for page/application and request bound objects?
When do all these objects become available for GC?.
 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are stored in heap. But when they should be garbage collected depends on the implementor of JSP Engine.
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Alok Pota:
Are user objects bound to the request, session, pagecontext, application objects of a JSP stored in the Java heap? The servlet API offers some control over session bound objects why is there no control provided for page/application and request bound objects?
When do all these objects become available for GC?.


These objects are stored where you allocate all Java objects -- which, indeed, is the heap.
With "control" I assume you mean HttpSessionBindingListener. The reason you need it is that a session can be expired anytime by the server. The lifecycle of all other scopes is a lot more predictable:

  • Page scoped objects are essentially local variables, they are released when you leave the page.
  • Request scoped objects are released when you've reached the last servlet in the chain processing the request.
  • Application scoped objects stay around until the server reclaims the ServletContext (usually only when it is shut down). I think this is the only one where you might wish for a HttpSessionBindingListener equivalent.

  • When these objects are eligible for garbage collection is not up to the implementor of the JSP engine, but defined in the JSP specification. When the garbage collection actually happens is undetermined, as always.
    - Peter
 
reply
    Bookmark Topic Watch Topic
  • New Topic