important! Re: [omniORB] Deactivating/reactivating servant vs IOR.

Frederic Prin frederic.prin at silvaco.com
Thu Jun 17 13:09:34 BST 2004


Thanks very much Jon and Duncan.

This works well!

I'm surprise that I did not saw the Duncan's responses mail you are
talking about ?
Is it recent, so my mailer is broken, or old mails ?

May I ask you an ultimate question:
I was trying to find the OMG Corba 2.6 ORB Spec document (omniORB is
based on) on the OMG web site.
I found some pdf but it's not really a reference manual with all the ORB
API. 
Do you have some ORB API documents to work with omniORB ?

Thanks again.

Fred

-----Original Message-----
From: Jon Dyte [mailto:jon at totient.demon.co.uk] 
Sent: mercredi 16 juin 2004 21:32
To: Frederic Prin
Subject: important! Re: [omniORB] Deactivating/reactivating servant vs
IOR.


Hi Fred

it's important to read Duncan's responses, it's a much simpler solution,

though mine works as well.

For yr first problem, I think this is the simplest solution.

In short you need to do this as normal
event_observer = new MyObserver ;
CosNotifyComm::StructuredPushConsumer_var push_consumer ; ....
push_consumer = eventObserver->_this() ;


and where you want to delete the event_observer 
replace "delete event_observer;" with 
// NEXT LINE IMPORTANT
event_observer->_remove_ref();
PortableServer::POA_ptr poa = event_observer->_default_POA();
poa->deactivate_object(*(poa->servant_to_id(event_observer)))



The destructor of event_observer may not be called immediately but it
will get called when the orb determines the servant is no longer used.

thats only three lines of code to change!

Hope this helps.



Jon

n Wednesday 16 June 2004 09:40, you wrote:
> Thank you very much Jon for your 2 responses.
>
> I will sutddy the first solution (about Deleting a
> StructuredPushConsumer) with care, since it's not trivial for me!
>
> The second answer is to use activate_object_with_id! That was the 
> direction where I was going!
>
> To respond to your question:
> Yes I rebind my servant to the NS, and yes you're right this is why 
> reconnect works! I did not first see the difference between old and 
> new IOR (only 1 digit changes)!
>
> Thanks again. I'll keep you in touch when it will work.
>
> Best regards,
>
> Fred
>
> -----Original Message-----
> From: Jon Dyte [mailto:jon at totient.demon.co.uk]
> Sent: mardi 15 juin 2004 22:43
> To: Frederic Prin
> Subject: Re: [omniORB] Deactivating/reactivating servant vs IOR.
>
>
> Hi Fred
>
> I think you will need to set appropriate policies on the
> poa on which the object is active. specifically I think you will need 
> the USER_ID policy and you will have to use activate_object_with_id, 
> to make sure the object gets activated with the same id.
>
> after you reactivate the object do you rebind it in the nameservice? 
> that would explain why it is working when you reconnect via 
> nameservice
>
> jon
>
> On Tuesday 15 June 2004 14:57, Frederic Prin wrote:
> > Hi all,
> >
> > A simple question:
> >
> > - Do a servant IOR change when deactivating then reactivating it ?
> >
> >
> >
> > Suppose you have a servant activated with a client connected to it. 
> > The client previously locate the servant using the NameService and 
> > narrow the IOR to a a proxy object (all works fine). The server 
> > decide
> >
> > to deactivate the servant
> >
> > 	PortableServer::ObjectId_var id =
>
> root_poa->servant_to_id(mServant);
>
> > 	root_poa->deactivate_object(id);
> >
> > If the clients make a call to the servant it will catch a 
> > OBJECT_NOT_EXIST exception; that is fine too.
> >
> > So now, the server reactivate the (same) servant:
> >
> > 	root_poa->activate_object(mServant);
> >
> > And the client tries again to make a call to this servant and still 
> > catch a  OBJECT_NOT_EXIST  exception.
> >
> > If I reconnect from scratch
> >
> > 	CORBA::Object_ptr p = m_NSRootContext->resolve(nsName);
> > 	MyInterfaceObj = MyInterface::_narrow(p);
> >
> >
> > It works !
> >
> > So is it possible to reinitialize an existing client proxy obj to a 
> > reactivated servant channel without having to reconnect using the 
> > IOR

> >
> > ?
> >
> > Client side, I try to re _narrow  MyInterfaceObj  but it didn't 
> > work.
> >
> >
> > Thanks for any idea.
> >
> > Fred
> >
> >
> >                               (
> >      Frédéric Prin          )
> >      Senior Software Engineer /
> >           S I L V A C O      (
> >      Grenoble REsearch CEnter \
> >      Tel 04 56 38 10 33        )
> >     __________________________/___
> >    /__/__/__/__/__/__/__/__/__/__/
> >   /__/__/__/__/__/__/__/__/_____/  /__/__/__/__/__/__/__/__/__/__/





More information about the omniORB-list mailing list