View · Search · Index
No registered users in community xowiki
in last 10 minutes

Re: [Xotcl] Object destruction on exit

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Thu, 02 Feb 2006 23:33:36 +0100

Kristoffer Lawson schrieb:

> When XOTcl exits, it seems that the [destroy] method is called on all
> objects. The first question is whether this is wise .. possibly.


well, it was some work to do so, and i think this is important from the
oo-point-of-view.
If one allocates "external resources" (e.g. temp-files, register on a
whiteboard, etc)
and deallocates these resources in a destructor, the deallocation should
certainly
happen, when the program exists gracefully.

> The problem is I would like to build a transparent layer for
> persistence storage which could be applied to a wide range of
> applications. The problem naturally is that the objects in the
> persistence storage get destroyed when the application exits :-)

a strong coupling of the destruction of an xotcl object with its
persistent representation
is often not a good idea. For example, in the aolserver, persistent
objects will be used
in connection threads, which are created/terminated based on demand.

note, that also the creation of objects is in the persistent situation
different. When one creates
a new object, it is expected to be in a freshly initialized state. In
the persistent case,
you might want do decide, wether you want a fresh persistent object, or
a refetched
object from the last checkpoint. I use normally a fetch and delete method.
You can still call e.g. delete from the destructor if you need it....

-gustaf

>
> / http://www.fishpool.com/~setok/
>
> _______________________________________________
> Xotcl mailing list
> Xotcl_at_alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl