Add this:
include DRbUndumped
why? it seems to work without it?
./factory.rb &
./client.rb
#<DRb::DRbObject:0x401f1f1c @ref=nil, @uri=“druby://localhost:12345”>
#<DRb::DRbObject:0x401f1940 @ref=nil, @uri=“druby://dhcppc1:4723”>
“name”
“child amethod”
#<DRb::DRbObject:0x401f0cac @ref=nil, @uri=“druby://dhcppc1:4725”>
“name”
“child amethod”
factory.rb
--------cut--------
#!/usr/local/bin/ruby
require ‘drb’
class Distributed
class Parent
include DRbUndumped
def amethod
‘parent amethod’
end
def name
‘name’
end
end
class Child < Parent
include DRbUndumped
def amethod
‘child amethod’
end
end
def get_object
ad = Child.new
server = DRb::DRbServer.new(nil, ad)
DRbObject.new(nil, server.uri)
end
end
parent = Distributed::Parent.new
child = Distributed::Child.new
puts parent.amethod
puts child.amethod
DRb.start_service(‘druby://localhost:12345’, Distributed.new)
DRb.thread.join
--------cut--------
client.rb
--------cut--------
#!/usr/local/bin/ruby
require ‘drb’
require ‘drb/drb’
DRb.start_service
ro = DRbObject.new(nil, ‘druby://localhost:12345’)
p ro
it = ro.get_object
p it
p it.name
p it.amethod
it = ro.get_object
p it
p it.name
p it.amethod
--------cut--------
-a
···
On Mon, 18 Nov 2002, Eric Hodel wrote:
–
====================================
Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================