[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mico-devel
Subject:    [mico-devel] Servant Activator mechanism.
From:       "Peter Fischer" <pfischer () ira ! uka ! de>
Date:       2005-09-21 16:10:07
Message-ID: op.sxgm6zuvs7iul9 () i31p32
[Download RAW message or body]

Hello,

I incorporated the account3 example to use the imr for some project I am  
working on.
My question is about the ServantActivator::incarnate() function. In the  
account3 example it creates a new Account object with new and returns the  
pointer to it. But in my project I am not sure whether my object  
( 'camera_impl', pointed to and created by a surrounding object called  
'corbamanager' ) exists already. Sure, I could test via an if() statement  
in the incarnate function whether the corbamanager and the camera_impl  
object exist already, but what if not? The incarnate function has to  
return a valid pointer I think, and it would be of no use if the code in  
the corbamanager object which invokes the camera_impl constructor is  
executed afterwards.
So the problem I have is that the camera_impl object currently is created  
on server startup in the corbamanager object. When I start up the server  
the first time it creates the object for itself without the  
ServantActivator mechanism. But when the server is down and incarnate is  
invoked, can I be sure that the code that creates the object (in the  
corbamanager object) is executed before or after or concurrently? What is  
the order in execution? - I think at first the server (and with it the  
"corbamanager" object) is started by the persistent POA and then the  
incarnate function is invoked? - But how could the POA decide whether the  
server is finnished with starting up and when to invoke the incarnate  
function? Or is it called as the very first function before the server is  
started?
So the problem is when requests come via the POA and the object is  
incarnated on demand, possibly twice, because the server starts and  
creates it, and one more time the incarnate function.
And invoking the incarnate function by hand in the corbamanager object to  
make sure that this is the only place the camera_impl object could be  
created either by my corbamanager object or by the POA and testing whether  
the camera_impl object already was created via an if() statement, is this  
the solution? So the first one who enters incarnate() creates the  
camer_impl object? What about concurrency (reentrance of the function), do  
I have to do thread synchronization so that incarnate is not called  
concurrently by both the POA and my 'corbamanager' object?

You see, I'm a little puzzled and would be very thankful for any hint.

Friendly greetings,

Yours

Peter.
_______________________________________________
Mico-devel mailing list
Mico-devel@mico.org
http://www.mico.org/mailman/listinfo/mico-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic