Eric Hodel wrote:
> Not quoting past messages is very bad form.  Please quote relevant
> parts of the message you are replying to.

i am very sorry



i guess i better give an example:

a master/server M has an object A that he want to put into tuplespace 
(using write).
a worker/client C1 wants to have a copy of the object A for himself to 
work with (by using read, instead of take).
a worker/client C2 also wants copy of object A (also using read).

the problem is, i currently only know that M have to use 
DRb::DRbUndumped (or use the alternative dumping as listed in the first 
reply of this topic by -a) if A is to be put into tuplespace, which is a 
pass-by-reference, meaning that the copy of A that each client C1 and C2 
has is actually the very same object currently residing in master M 
(since the one put into the tuplespace is none other than DRbObject 
reference to the object A)

what i need is that M to put exactly a copy of object A into the 
tuplespace instead just a reference to the object A, and C1 and C2 to 
each have the copy of the copy of object A that was previously inserted 
into the tuplespace, so that if C1 or C2 each modifies the copy (of copy 
of A, if that matters), it only appears to himself. this is what i 
believe is a pass-by-value

> ...
>
> #read is not dangerous.  #take can lose the object if the taking node
> quits before receiving the object, so you should use a
> TupleSpaceProxy whenever you take tuples.

i am using tuplespaceproxy, thank you

> That is as intended.  It is called Distributed Ruby after all.
> 
> It sounds like you really want some kind of access control or locking
> mechanism.
> 
> ...
> 
> Your problem seems to be an implementation detail.  It seems you want
> an object usable by only one node at a time.
> 
> You should either use take to remove the object from the TupleSpace
> or provide locking via the TupleSpace to prevent other nodes from
> fiddling with your object while one node is working on it.
> 
> Pass by reference allows a transparent object space.  Pass by value
> is going to complicate your design much more than building atop of
> the primitive operations TupleSpace provides.
> 
>> i currently combine Rinda::TupleSpace and Rinda::Ring instead of  
>> putting
>> the tuplespace as a DRbServer's front object, trying to make the whole
>> thing works like jini
> 
> I don't understand what this means.

javaspace is a service to jini. for further reference, please use 
http://www.jini.org

i am using Rinda::TupleSpace and Rinda::Ring based on your example, Mr. 
Eric, and i prefer using it compared to serving a TupleSpace instance as 
a DRbServer's front object, since the Ring API works somehow like jini's 
lookup service

-- 
Posted via http://www.ruby-forum.com/.