doubt abt finalizer method

S

Sanjay

Chris,

May be my question was not very clear, but what I meant is
Don't worry about the garbage collector collecting objects that you're
still using.

In the scenario that I mentioned I wouldnt have to worry about final()?
Right?

Sanjay
 
R

Roedy Green

When you call System.runFinalizersOnExit and there exists any daemon
thread anywhere in the application, it's almost guaranteed to happen.
It's not necessarily guaranteed to cause deadlock or race conditions,
but it very well might.

With System.runFinalizersOnExit( true ) does it run finalize on ALL
objects even reachable ones, or just unreachable ones?

If reachable ones too, I think that deserves a gotcha. I would never
have expected that.
 
C

Chris Smith

Roedy Green said:
With System.runFinalizersOnExit( true ) does it run finalize on ALL
objects even reachable ones, or just unreachable ones?

All objects.
If reachable ones too, I think that deserves a gotcha. I would never
have expected that.

To me, "gotcha" implies that there's some surprising aspect of an API,
but you should learn that bit and then still use it. This doesn't fall
into that category. If you can convince people not to use the API, then
go for it.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,146
Latest member
Vinay KumarNevatia_
Top