Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Prototype spring bean destruction

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my servlet I get a spring bean that is scoped as prototype. Will this bean get destroyed, as would any de-ref'd object during GC, or do non-referenced prototype beans hang around until the container shuts down? I'm assuming if the bean is de-refed and destroyed that its dependencies are also destroyed (assuming zero references) and its dependencies are destroyed, and so on...

I'm just getting the hand of IOC and want to make sure that my prototype objects are not leaving a pile of objects on the heap when they have no references.

i.e.: bean C is invoked programaticaly by getBean(). B->was injected into C and A-> was injected into B
A->B->C

I'm hoping that when C has no more references or the reference goes out of scope, that C,B and A are cleaned up during the GC cycle. (assuming A,B,C are all scoped as prototype)

Can anyone recommend a good, lightwieght profiler to monitor which beans (objects) are on the heap in realtime? I'm using JProbe now, but its more than I need (or can handle at the moment..)

Thanks a lot .. Spring has me excited about coding again...!

Billy.



 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, it will not be "retained" by the container in the case of prototype scope.

Mark
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic