[omniORB] Object activation...

David Riddoch djr@uk.research.att.com
Thu, 21 Jun 2001 10:01:07 +0100 (BST)


On Thu, 21 Jun 2001, Andrew Weaver wrote:

> Moi, this is a bit worrying....
> 
> "...
> Calling _this() will cause implicit activation in the root POA, IIRC. In
> fact this would explain the behaviour of it, the object activation should
> happen before _this() is called.
> ..."
> 
> In my specific case, I wanted to host several interfaces in the same process
> space and I want to open for business when _I_ was ready. I thought I could
> control that through the poa manager activate calls.

You can.  An object will only be contactable when it is activated _and_
the POA is in the active state.


> If I only use persistent refs, I assume that the objects wont become
> available to the outside world until I activate the poa. For dynamic refs,
> it seems I am at the mercy of the orb.

Not true.  Just because you accidentally activated the object before you
meant to, doesn't mean that it was accessible to clients.

The RootPOA has the 'implicit activation' policy, which means that if you
try and obtain a reference to a servant that is not activated but that is
using the RootPOA, then it will automatically be activated.  Yes, this is
disgusting, but it is what the spec says the ORB should do.  Note that you
can still fall into this trap if you use a different POA to the RootPOA.

If you want to get hold of a reference to an object that you have not yet
activated, the following will do:

  CORBA::Object_var ref =
    poa->create_reference_with_id(my_id,"IDL:myinterface:1.0");

Or if you are using a POA with the SYSTEM_ID policy (such as the RootPOA):

  CORBA::Object_var ref = create_reference("IDL:myinterface:1.0");

Then when you want to activate that object:

  poa->activate_object_with_id(my_id, servant);

If you don't already know my_id, do:

  my_id = poa->reference_to_id(ref);


> Are there any other "implicit" things we need to know about?

I think this is the main one.


Hope that helps,
David