AW: [omniORB] Destructor and Factories
Ralf Walther
rw@neurotec.de
Thu, 10 Dec 98 19:06:00 GMT
Hi Martin, hi CORBAholics!
> >To destroy the server object you have to use the _boa()->dispose(obj)
> >call, which will destroy the object when its server-local reference
> >count hits zero.
>
> Exactly this is my problem: When should I call dispose()?
Yep, ... you have to think about this very carefully!
>
> My factory will produce about 10000 objects (no typo) and under normal
> circumstances, the corba-server will be up for several months. So the
> client has to show somehow that he doesn't want to use an
object-reference
> any longer (an object-reference which the server explicitly created for
> this client).
The sense of this mechanism lays in the complete control of the server on
all objects, which have been created it its address space. Obviously
there is
no intrinsic way to let a client delete an object or trigger the
destruction via
the ref count of the client's proxy. If it should work in this matter,
the server
object would have to manage all refs from all clients AND if only one
client orders a
ref and then never get connected to the server again ... when should the
object be destroyed then? It's ugly, too, isn't it?
> One solution would be, that the client calls a oneway-method of this
> object, which contains something like "_boa->dispose(this)", but that's
> ugly, ugly!
Ups! Remember, that you could run into trouble, because no client can be
sure,
that the operation was sucessful.
> Is there no other way, how I can delete objects, that the client
doesn't
> want to use any longer?
Hmmm ... indeed, we had a similar problem. We havn't found a really good
solution,
but our servers control all objects and their destruction depends on the
processes on them, not on the count of refs outside in the clients world.
Did you ever look at the Lifecycle service?
Best Regards
Ralf