Commit Graph

2 Commits

Author SHA1 Message Date
Joel Dice
4297fa04b3 run java finalizers in a separate thread to guarantee no application locks are held when doing so 2009-08-24 17:51:31 -06:00
Joel Dice
3787985b25 implement basic finalization support
This implementation does not conform to the Java standard in that
finalize methods are called from whichever thread happens to be garbage
collecting, and that thread may hold locks, whereas the standard
guarantees that finalize will be run from a thread which holds no locks.
Also, an object will never be finalized more than once, even if its
finalize method "rescues" (i.e. makes reachable) the object such that it
might become unreachable a second time and thus a candidate for
finalization once more.  It's not clear to me from the standard if this
is OK or not.

Nonwithstanding the above, this implementation is useful for "normal"
finalize methods which simply release resources associated with an
object.
2009-07-21 18:57:55 -06:00