C
curtis.schofield
Hi.
Distributed ruby seems to have issue with dispatch doen via
method_missing on the remote side. Is there a possible workaround for
this..
Here is a little test case that demonstrates the issue
#
# DRb method_missing test
#
class Tom
def bloop
puts "TOM GOES BLOOP"
return %w{h a t s a r e f u n}
end
def method_missing(method,*args)
puts "TOM :: method_missing #{method}"
end
end
class MMObject
def initialize()
@tom = Tom.new
end
def method_missing(method,*args)
@tom.send(method)
end
end
URI = 'druby://localhost:9000'
def server
mmObject = MMObject.new
DRb.start_service(URI, mmObject)
DRb.thread.join # Don't exit just yet!
end
def client
DRb.start_service()
mmObject = DRbObject.new(nil,URI)
mmObject.bloop
mmObject.whatever
end
require 'drb'
if __FILE__ == $0
begin
if not ARGV.nil? and ARGV.size == 1
send(ARGV[0])
else
raise "No Argument"
end
rescue
puts $!.message
puts "To Use this run with argument:
'server' to launch server instance
'client' to launch client instance
(which connects to server instance)
"
end
end
Distributed ruby seems to have issue with dispatch doen via
method_missing on the remote side. Is there a possible workaround for
this..
Here is a little test case that demonstrates the issue
#
# DRb method_missing test
#
class Tom
def bloop
puts "TOM GOES BLOOP"
return %w{h a t s a r e f u n}
end
def method_missing(method,*args)
puts "TOM :: method_missing #{method}"
end
end
class MMObject
def initialize()
@tom = Tom.new
end
def method_missing(method,*args)
@tom.send(method)
end
end
URI = 'druby://localhost:9000'
def server
mmObject = MMObject.new
DRb.start_service(URI, mmObject)
DRb.thread.join # Don't exit just yet!
end
def client
DRb.start_service()
mmObject = DRbObject.new(nil,URI)
mmObject.bloop
mmObject.whatever
end
require 'drb'
if __FILE__ == $0
begin
if not ARGV.nil? and ARGV.size == 1
send(ARGV[0])
else
raise "No Argument"
end
rescue
puts $!.message
puts "To Use this run with argument:
'server' to launch server instance
'client' to launch client instance
(which connects to server instance)
"
end
end