[omniORB] Destroying itself

Duncan Grisby duncan at grisby.org
Fri May 12 14:45:29 BST 2006


On Tuesday 9 May, "=?ISO-8859-1?Q?Attila_Czig=E1ny?=" wrote:

> I am working on an application, which does some processing, there are
> clients which ask for a processing object, make it do the processing, get
> the result, and leave.
> Till now I made a Provider object, which creates a new Processor object for
> this client, and sends its reference to the client.
> After the client finished with its needs, I want to destory the Processor.
> I could use the poa->deactivate_object but it would be better not to use an
> additional method, ot put it at the end of the processing method.
> I want so that the destroy would happen after the client disconnected. Is it
> possible to do such auto destroy?

This is a complex area. You can't simply destroy an object when its
client disconnects, because CORBA has no notion of a "connection" that
you can use. The calls happen through TCP connections, but connections
are opened and closed at arbitrary times on demand, so presence or
absence of a connection doesn't tell you anything useful. Connection
management is transparent to the object model.

That said, there are various approaches to managing object lifetimes.
Which is the best for you depends a great deal on what situation you are
in. I recommend that you get "Advanced CORBA Programming with C++" by
Henning and Vinoski, and read what they have to say. They have some good
material about things like the evictor pattern that can be helpful. I
don't agree with all their opinions (I think timeouts are more widely
useful than they suggest, for example), but it's a good starting point.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-list mailing list