[omniORB] Re: remote object references
Glenn A. Hochberg
ghochberg@att.com
Wed, 15 Mar 2000 14:36:31 -0500
A common solution that is used is to employ the Naming Service to
register only the "top-level" objects in a service. Some of these
top-level objects are typically object factories that dynamically create
new instances or locate existing ones. For example, you might have a
single SessionFactory object in a server that can create new Session
objects or find existing ones:
interface Session {
readonly attribute string id;
/* some methods */
};
interface SessionFactory {
Session createSession();
exception NotFound {};
Session findSession(string id) raises (NotFound);
};
This kind of design reduces the overhead of having every CORBA object
register with the NamingService, and reduces the load on the
NamingService of all the lookups for the individual objects. In the
above example, since the SessionFactory creates the Session objects, it
can save pointers to them in a map or hash.
-Glenn
"Ji-Yong D. Chung" wrote:
> Jim Moe wrote:
> >> If I create a CORBA object on the first machine, and if I want to
> pass
> >> that object's remote reference to the second, can I make the first
> machine
> >> obtain it, and pass it to the second host? In other words, if I
> create a
> >> local corba object and obtain its CORBA object reference (created
> on the
> >> localhost), can I send it off to other hosts as valid object
> reference? Or
> >> is the obtained reference only good on the original host?.
> >>
> > This is what the COSNaming Service is for. The server on mach #1
> >registers itself with COSNaming. The client on mach #2 queries
> COSNaming
> >for the object reference of the object it desires. Thanks for
> your reply. While your solution probably would work, IMHO, it does
> not quite seem "right." Consider a more complex scenario: say
> machine A dynamically created 10 objects, and it wants the machine B
> to have all the references of those objects. It just would not be
> efficient for machine A to transmit the names of the 10 objects to the
> machine B, so that machine B can then query the COSNaming Service 10
> times (the cost of each query is on the order of few milliseconds due
> to the network latency). It seems to me that once machine A has
> the object references (at the time of its CORBA object creations), it
> would be far more efficient to just pass the references directly to
> machine B (provided that machine A knows that server B should receive
> the object references). Of course, I am assuming that Mr. Klimek is
> right; that is, it is legal to pass object references around in a
> distributed environment. But then again, I could be missing
> something ...