Re: DO and Proxy Indirection
Re: DO and Proxy Indirection
- Subject: Re: DO and Proxy Indirection
- From: email@hidden
- Date: Thu, 09 May 2002 09:16:59 -0700
(DO, for those not in the know, means "distributed objects")
Timothy Ritchey wrote:
|Say I have two objects talking remotely. Let's call the first one
|Factory-A, and the second one Repository-B. The factory has registered
|with the centralized repository so that the repository can ask it to
|create objects on its behalf. Now, a third object, GUI-C, wants to talk
|to the repository, and ask for objects. Can the repository simple do
|something like:
|
|@implementation repository
|
|- (id)getObjectWithID:(NSString*)identifier
|{
| return [factory getObjectWithID:identifier];
|}
|
|@end
First off, as I understand DO, if the repository wants to call factory methods, the repository has to get a client object from the factory, rather than the factory registering with the client. (That is, the caller has to establish the connection.) If you want the factory to be able to call repository methods as well (necessary if the factory is actually registering with the repository), the factory has to be given a proxy object for the repository. (Each direction of communication requires that the calling object have a proxy for the called object.)
Assuming that the repository calls the factory, and not vice versa, then the above method will (probably) return a proxy object for whatever the factory creates. (I say "probably" because I'm not 100% certain that DO will *always* return a proxy under all circumstances.)
|? In the GUI-C address space, do we end up with a
|proxy-to-a-proxy-to-an-object, or with simply a proxy-to-an-object?
How did GUI-C get access to the repository? Is the GUI-C repository a proxy object for the real repository, or is GUI-C talking to the actual repository. If the latter, then GUI-C gets whatever the repository gives it (likely a proxy, since it sounds as if that's what the repository is storing), since DO isn't being used. If the former, then it depends on whether DO can reuse a proxy object, something I don't recall seeing addressed anywhere.
Are you thinking about efficiency, or are you doing something which requires that you *not* have a proxy? If it's about efficiency, I'd worry about that only after it's shown (by profiling or some such thing) that a proxy-to-a-proxy is a significant source of inefficiency. Unless there's a *lot* of traffic over the DO link, it's not likely having all that much impact. (If there *is* that much traffic, then perhaps you should make a local copy--not a proxy--of the real object.)
Glen Fisher
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.