Daniel Dekany wrote:

Sunday, December 14, 2003, 2:28:14 PM, Stephen McConnell wrote:



Daniel Dekany wrote:



Saturday, December 13, 2003, 6:34:55 AM, Stephen McConnell wrote:




Normal VM termination triggers a shutdown hook. The shutdown hook triggers shutdown of the kernel. Kernel shutdown triggers decommissioning of the root application block. Block decomissioning triggers orderly decommissioning of the appliances contained within it. Appliance decommissioning trigers disposal of the associated lifestyle handler. The lifestyle handler maintains a soft references queue and

from this can locate and non-finalized component instances and invoke


component decommissioning.




Are you sure? A soft reference to object O my cleared (=> get() returns
null, so you can access O anymore) before O.finlaize() is invoked. So it
can happen that you can't access O with soft reference, but it is not
finalized yet either.



The soft reference is to the proxy so if the reference returns null we
know that the proxy has been finalized which means that the
corresponding component has been decommissioned.


[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. 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.


I.e. if the ref returns null - we know that it is in the pipeline for finalization - otherwise we take care of it manually.

Stephen.

--

Stephen J. McConnell
mailto:[EMAIL PROTECTED]

|------------------------------------------------|
| Magic by Merlin                                |
| Production by Avalon                           |
|                                                |
| http://avalon.apache.org/merlin                |
| http://dpml.net/                               |
|------------------------------------------------|





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to