[omniORB] RE: omniORB-list Digest, Vol 5, Issue 12

scott.rediger at teradyne.com scott.rediger at teradyne.com
Mon Sep 15 11:49:09 BST 2003


>> I'm confused regarding the use of CORBA::release() and object lifespan

>> etc..  Suppose I got the following idl
>>
>> interface Hello {
>>    string say_hello();
>> };
>> interface Server {
>>    Hello get_hello();
>> };
>>[...]

>> Now, if I call get_hello() from the (Java) client, what should I do?
>> call CORBA::release from the java client if I'm done with the object?

>In general you can't (or shouldn't be able to) know that from the client
>side. The implementation is hidden behind the interface, so the server
must
>somehow keep track of the servants that it instantiates (or let the ORB do
>it).

In my experience, if you want the client to control lifecycle-type issues,
you should be using a factory/manager/container type of design pattern.
This manager object could act as both a factory for creation, and a
disposer when the client is finished. This way you are not letting the
client directly dictate lifecycle issues, but letting them indicate when
they are done with an object, and letting the server decide if it is using
a pool of objects behind the interface or explicitly creating and
destroying them each time.

For what it's worth,
Scott Rediger





More information about the omniORB-list mailing list