[omniORB] Question about passing arguments to preinvoke()

Michael Shearer mshearer at aastra.com
Wed Jun 14 11:59:28 BST 2006


Hi Duncan,

Thanks for the quick response.  I guess I didn't really need a servant
locator after all.  The problem I was having was that my server
application was sometimes deleting the servant before the client was
done with it.  Even when using PortableServer::RefCountServantBase
reference counter.  

When I saw the servant locator and servant activator models, it seemed
to make more sense at the time because it would tell you when the client
was done so you could then in turn cleanup and delete the resource.
However, after much research I found this great website that explains
this whole issue.  http://www.lenholgate.com/archives/000343.html.  All
I really needed was a reference counter wrapper in my own class that
calls deactivate_object and _remove_ref() on the RefCountServantBase
class when it is done.  Works like a charm now.

Thanks,

Mike

-----Original Message-----
From: Duncan Grisby [mailto:duncan at grisby.org] 
Sent: Wednesday, June 14, 2006 10:27 AM
To: Michael Shearer
Cc: omniorb-list at omniorb-support.com
Subject: Re: [omniORB] Question about passing arguments to preinvoke() 

On Tuesday 13 June, "Michael Shearer" wrote:

> I'm trying to figure out a nice and clean way of passing arguments to
> the preinvoke primitive when using a CORBA servant locator.  I have an
> object that needs two parameters in the constructor when creating the
> instance.  Obviously I could add a primitive to initialize this data
> separately but ideally I'd like some way of passing the 2 arguments to
> the preinvoke.  What I'm doing right now is basically setting 2 member
> variables in the servant locator which are used in the preinvoke.
These
> 2 member variables are currently locked with a mutex as I'm not sure
if
> the POA ensures that no other object references will be requested
before
> the previous one has been dispatched. Is that the best I can do or am
I
> missing something?  Here's what it looks like in a nutshell:

I'm confused about what you're trying to do. The whole point of a
servant locator is that the servant is created/located on demand, when a
client calls an operation on the object. preinvoke can thus be called at
any time, as determined by the clients. How do you set the member
variables at the right time?  I suspect that you perhaps don't want to
be using a servant locator at all.

Can you explain what you are doing that makes you think you need to do
this?

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-list mailing list