[omniORB] Destroying object implementions in a factory etc

Viktor Mikho vvmikho@hotmail.com
Thu, 06 Jul 2000 19:56:11 PDT




>From: Andy Weber <Andy@arcontech.com>
>Date: Wed, 5 Jul 2000 13:13:31 +0100
>......
>After much head-scratching and experiment, I have managed to write
>destroyRecordData, as follows:
>
>void InstrumentDataFactory_i::destroyRecordData(RecordData_ptr  recData)
>{
>         RecordData_Helper::duplicate( recData);
>         CORBA::BOA::getBOA()->dispose( recData);
>}
>
>This works, calling the implementation's destructor, etc, and there are
>no memory leaks.  But is this the right/only way to do it?
>

Donno, I am a CORBA newbee and actually after reading your question I was 
waiting for a while to hear what the experts say. I have a similiar problem 
myself. Some hints for you, though: read chapter 20.3.2 of the "Advanced 
CORBA programming" by Michi Henning and Steve Vinoski.
They discuss similiar situation and say that CORBA uses is_equivalent() 
operation in order to find object references and that operation does not 
work reliably in all cases. So they suggest using extra class for the object 
disposal.(I have to say, I do not like their solution because the extra 
class should be destroyed itself somehow. I personally would use some magic 
object instance id (long) for things to be referenced/destroyed).


I have problem of a similiar sort:

Server side:

interface Mgr
{
   Filter createFilter();
}

interface Filter
{
   void doTuneUp(...); // set some filtering conditions, this is up to
                       // the client to decide - which conditions
   bool isElementOk(...);// this is called from the server side
                        //after client did doTuneUp
}

So it is what I was intending to do:
1. Client gets filter:
    myFilter = mgr->createFilter();
2. Client adjusts the filter
    myFilter->doTuneUp(....);
3. Client tells the server to use the filter in a subscription
    mgr->subscribeForCallBack(....., myFilter);
4. Now manager (server) is supposed to decide whether to notify the client 
about some events using the Filter:
   if(filter->isElementOk(..))
   {
    .... do smth
   }


My question is: will server know that the filter used in the
filter->isElementOk(..) is in fact the same filter which was created by the 
mgr in the step 1 or will it marshall call to the client with further 
marshalling call to the server?

I did not even try to do it because even after some experimentation I can't 
be certain if answer on this question is CORBA generic or 
ORB/network/platform specific.

So, what do the experts say?

Thanks,

Viktor

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com