How to start Drb service concurrently with other methods in Windows

32 Views Asked by At

I want to run the startdrb method concurrently with the printstuff method on a Windows system. I messed around with Thread.new but the service starts and terminates after the thread completes.

How would this be written?

require 'drb'
require 'drb/ssl'

class TestDRB
  def dostuff
    ...
  end

  def startdrb
    begin
      config = {SSLCertName: [["CN","DRuby"]]}
      DRb.start_service("drbssl://127.0.0.1:9911", BHRBeacon.new, config)
    rescue Exception => e
      puts e.full_message
    end

  def printstuff  
    begin
      puts "this will run while Drb service is also running"
    end

TestDRB.new.startdrb
TestDRB.new.printstuff

0

There are 0 best solutions below