Distributed Objects: Passing my objects to distant object
Distributed Objects: Passing my objects to distant object
- Subject: Distributed Objects: Passing my objects to distant object
- From: Rick Hoge <email@hidden>
- Date: Mon, 12 Jul 2004 23:52:31 -0400
I've been experimenting with distributed objects for implementation of
a simple load-sharing scheme in a Cocoa app. We have some
computationally intensive tasks that would be nice to run on idle
computers in our lab, and it looked like DO might be a fairly easy and
effective way to do this.
The processing operations are basically instantiated as objects - the
parameters and inputs are instance variables, and methods are defined
for performing the operation and returning the result. I had naively
envisioned something like this:
MyDataset *data = ... // An object with several ivars, some of them
other objects
MyFilter *processingObject = [[processingObject alloc] init];
[processingObject setX:3.5];
[processingObject setY:1.0];
[processingObject setInput:data];
NSSocketPort *sendPort = [[NSSocketPort alloc]
initRemoteWithTCPPort:SERVER_PORT host:serverName];
serverConnection = [[NSConnection alloc] initWithReceivePort:nil
sendPort:sendPort];
[sendPort release];
id theProxy = [serverConnection rootProxy];
[theProxy runFilter:processingObject]; // Run the filter on remote
server
Are there any special issues to consider in getting this to work? I
have been able to run simple methods like this (passing an NSNumber or
something) but when I use my own objects, I get crashes. Do I have to
implement my own coding protocols to be able to pass my objects, which
I gather must by value?
Thanks for any tips - if this works it will be pretty sweet...
Rick
P.S. an example crash log from the remote machine is here:
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x72617279
Thread 0 Crashed:
0 libobjc.A.dylib 0x908311f4 objc_msgSend + 0x14
1 com.apple.Foundation 0x90a12014 -[NSInvocation invalidate] +
0x54
2 com.apple.Foundation 0x90a02c4c -[NSInvocation dealloc] + 0x24
3 com.apple.Foundation 0x909f15d4 NSPopAutoreleasePool + 0x164
4 com.apple.Foundation 0x90a74abc NSLog + 0x1c
5 org.neurolens.neurolens 0x0000cf88 -[MyAppController
runPluginForClient:] + 0x20 (MyAppController.m:445)
6 libobjc.A.dylib 0x90836734 objc_msgSendv + 0xb4
7 com.apple.Foundation 0x909fabf0 -[NSInvocation invoke] + 0x374
8 com.apple.Foundation 0x90a20954 -[NSConnection
dispatchInvocation:] + 0xf4
9 com.apple.Foundation 0x90a140bc -[NSConnection
handleRequest:sequence:] + 0x3e8
10 com.apple.Foundation 0x90a1c760 -[NSConnection
handlePortCoder:] + 0x160
11 com.apple.Foundation 0x90a17888 -[NSConcretePortCoder
dispatch] + 0x54
12 com.apple.Foundation 0x90abca3c -[NSSocketPort
_handleMessage:from:socket:] + 0x358
13 com.apple.Foundation 0x90abe6c4 __NSFireSocketData + 0x24c
14 com.apple.CoreFoundation 0x901a28fc __CFSocketPerform + 0x260
15 com.apple.CoreFoundation 0x90193d38 __CFRunLoopDoSources0 + 0x1fc
16 com.apple.CoreFoundation 0x901915f0 __CFRunLoopRun + 0x1b0
17 com.apple.CoreFoundation 0x90195f1c CFRunLoopRunSpecific + 0x148
18 com.apple.HIToolbox 0x927d62d8 RunCurrentEventLoopInMode +
0xac
19 com.apple.HIToolbox 0x927dca40 ReceiveNextEventCommon + 0x17c
20 com.apple.HIToolbox 0x927feb18
BlockUntilNextEventMatchingListInMode + 0x60
21 com.apple.AppKit 0x92dd2a34 _DPSNextEvent + 0x180
22 com.apple.AppKit 0x92de93b0 -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 0x74
23 com.apple.AppKit 0x92dfd718 -[NSApplication run] + 0x21c
24 com.apple.AppKit 0x92eb9b80 NSApplicationMain + 0x1d0
25 org.neurolens.neurolens 0x0000ab48 _start + 0x188 (crt.c:267)
26 dyld 0x8fe1a558 _dyld_start + 0x64
_______________________________________________
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.