• 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

Destroy method of Applet...

 
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the destroy method called only at the time of browser close? I am using a buffered reader for my applet. I need to close the buffer at the end, when I close the buffer in the destroy method it gets closed after the applet is loaded completely. For further usages I am not able to access the buffered reader. How to close the buffer when the browser is closed or when the user navigates to some other page.

Ananth
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What kind of Reader is this, and why does it need to be kept open? The most natural thing to do would be to close the Reader when you're done with it.

To investigate the applet lifecycle you should write a little applet that prints messages to System.out whenever one of its lifecycle methods is called (init, start, stop, destroy). Then you'll get a feeling what code might go into which method. Also, not all browsers/JVMs are fully consistent as to when they call these methods.
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf.

I found that buffered reader cannot be re used. I gave a System.out in destroy method, and I found it is getting printed after every time the page load is complete. Now I am closing the buffered reader after use, and going to a servlet again to get the buffered reader when needed.

Thanks buddy
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic