i am currently using Ruby 1.8.4 and DRb 2.0.4, and i am stuck with some marshalling problem
related to tuplespace. this is my hello world code using tuplespace
···
---
#HelloWorld.rb
require "rinda/ring"
class HelloWorld
# include DRbUndumped
def initialize(str)
@str = str
end
def _dump(dumpDepth)
@str
end
def HelloWorld._load(srcString)
HelloWorld.new(srcString)
end
def to_s
@str
end
end
DRb.start_service
ringServer = Rinda::RingFinger.primary
tupleSpace = ringServer.read([:name, :TupleSpace, nil, nil])[2]
tupleSpace = Rinda::TupleSpaceProxy.new tupleSpace
tupleSpace.write(["helloWorldObject", HelloWorld.new("Hello World!")])
aHelloWorldObject = tupleSpace.take(["helloWorldObject", nil])
puts aHelloWorldObject[1]
#DRb.thread.join
---
my problem is that _dump doesn't work, because the HelloWorld object gets converted into
DRb::DRbUnknown, which can not be converted into tuple to be inserted into the tuplespace. it does
not occur if i use DRb::DRbUndumped, but i think using DRb::DRbUndumped is rather unsecure if i
try using read instead of take to get the object out of the tuplespace. the question is:
- what's wrong with my _dump (and _load) ? do i have to use DRb::DRbUndumped ?
- do i have to use Rinda::Ring to work with Rinda::TupleSpace ?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com