Sunday, December 14, 2003, 10:04:10 PM, Stephen McConnell wrote: > Daniel Dekany wrote: [snip] >>Why? Is it a soft reference cleared exactly when the referenced object >>is finalized? Is this two act united to form an atomic operation? I >>think they are not, so it is possible that the soft ref. cleared earlier >>than finalization is called (but please point out if the JVM spec. >>states something that prevents this to happen), so it is till not >>ensured that finalize() will be called before the VM terminates. >> > > The soft ref is to the proxy. The proxy always has a valid refernce to > the component. If the soft ref returns null, then the object referenced > by the soft ref (the proxy) has been finalized (or according to the spec > is at least queued for finalization). This means that by defintion the > proxy has or is about to decommission the component.
Correct... (IMO) > If the value retured from the ref is not null - then we have a > reference (in a thread) to the proxy and the proxy has a hard > reference to the component and we trigger decommissioning directly. Correct... (IMO) > I.e. if the ref returns null - we know that it is in the pipeline for > finalization - otherwise we take care of it manually. Correct. (IMO) So what? If ref.get() == null, you only know that it is "at least queued for finalization". But, again, it does not means that the finalization will actually happen. Because, even if the object is queued for finalization, the VM can terminate before actually doing that. Or is it the VM required to finalize all queued objects before terminating? (Point that sentence in the specs.) -- Best regards, Daniel Dekany --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
