[omniORB] Persistent Obj Refs.

Richard Hardgrave hardgrav@ttd.teradyne.com
Tue, 19 Jun 2001 11:00:07 -0500 (CDT)


> 
> On Tue, 19 Jun 2001, Andrew Weaver wrote:
> 
> > Moi, here is some modification of eg2_impl from the
> > $TOP/src/examples/poa/persistent_objeref
> >
> >     // Activate the echo object...
> >     Echo_i* myecho = new Echo_i();
> > //
> > // AWE - 1
> > //
> >     obj = myecho->_this();
> >     CORBA::String_var sior(orb->object_to_string(obj));
> >     cerr << "AWE 1 '" << (char*)sior << "'" << endl;
> >
> >     poa->activate_object_with_id(oid, myecho);
> > //
> > // AWE -2
> > //
> >     obj = myecho->_this();
> >     CORBA::String_var sior2(orb->object_to_string(obj));
> >     cerr << "AWE 2 '" << (char*)sior2 << "'" << endl;
> >
> > With the code like this, I get the same string for the IOR from the AWE -1
> > block as from AWE-2. However, this string is not the same from run to run.
> >
> > If I comment out the AWE-2 code, I get not the same string run to run.
> >
> > Only when the code is as the original (with only AWE-2 code active) all is
> > OK. I am curious about this behaviour.
> 
> omniORB won't generate the same IOR for the same object ID on each run
> unless you use a special POA. You can get a reference to this POA using
> orb->resolve_initial_references("omniINSPOA"); Even setting the PERSISTENT
> life span policy won't get you IORs that don't change...
> 
> This turned out to be a particular problem for me a little while ago
> because I had wanted to use a POA with PERSISTENT set and a servant
> manager to load objects from a database as required. Instead I work around
> it by having the clients call a special 'find' method if they get any
> unexpected exceptions (eg an OBJECT_NOT_EXIST exception caused by the
> server restarting).
> 
I'm curious about your need for the "find()" method.  Are you saying
that the original IOR for a particular servant goes "stale", occasionally?
I. e., if the servant restarts, the more recent IOR is required.  And, since
I'm new to CORBA, is it normal for servants that are not receiving client
requests to periodically "expire"?  I, myself, am likely to use a servant
"manager" mechanism.  Should the manager only invoke a servant at the time
the client makes the initial request, or is it going to be okay to keep a
pool of servants available?  Clients, once making the initial request, will
conduct their business only briefly, and the servant will be "returned" to
the manager for administration.  It's the manager that actually invokes the
servant and passes the IOR to the client.

Richard