Passing objects between clients

Nick Brown nickbrown at fastmail.fm
Wed Sep 23 14:37:18 UTC 2009


Hi. I'm just trying out Magma for the first time.

I'm interested in using it to allow pieces of work (which I'll call 
'jobs') to be handed out to one or more Squeak images ('workers').

On startup, each worker opens a connection to the Magma server, checks 
to see whether there are any jobs waiting to be done. If there are, the 
worker will take the first job off the queue, run it, and ultimately 
commit the result of the job back into Magma.

Other Magma clients are periodically going to push new jobs onto the end 
of the queue.

My first attempt just used an OrderedCollection to represent the queue, 
with one Magma client adding Arrays of numbers to it with #add: to 
simulate jobs being added; and another client removing them with 
#removeFirst; to simulate jobs being accepted by a worker.

This approach is prone to conflicts, presumably because each #add: or 
#removeFirst: is attempting to rewrite the entire internal state of the 
OrderedCollection.

So my question is, is there a better way of doing this? Use Magma to 
pass semaphores between clients? Or just live with the conflicts?

Thanks for any insight.

-Nick



More information about the Magma mailing list