require 'drb'
class QServer
def initialize
@q = Queue.new
end
def push str
@q << str
end
def pop
@q.pop
end
def shift
@q.shift
end
def size
@q.size
end
end
server = QServer.new
DRb.start_service('druby://localhost:9000', server)
DRb.thread.join
require 'drb'
require 'eventmachine'
require 'pp'
EM.run do
DRb.start_service()
obj = DRbObject.new(nil, 'druby://localhost:9000')
EM.add_periodic_timer(3) do
5.times{pp obj.push 'test'}
end
end
require 'drb'
require 'eventmachine'
require 'pp'
EM.run do
DRb.start_service()
obj = DRbObject.new(nil, 'druby://localhost:9000')
EM.add_periodic_timer(2) do
3.times{pp obj.pop}
end
end