Module: DRb
- Defined in:
- lib/emdrb/unix.rb,
lib/emdrb/emdrb.rb
Defined Under Namespace
Modules: DRbClientProtocol, DRbEMSafe, DRbProtocolCommon, DRbServerProtocol, DRbTransport Classes: DRbObject, DRbProcWrapper, DRbServer, DRbTCPSocket, DRbUNIXSocket
Constant Summary collapse
- DEFAULT_ARGC_LIMIT =
256
- DEFAULT_LOAD_LIMIT =
256 * 102400
- DEFAULT_SAFE_LEVEL =
0
Class Method Summary collapse
-
.start_drbserver(uri = nil, front = nil, config = nil) ⇒ Object
This is the ‘bare bones’ start_service which can be used to start a DRb service from within an existing event loop.
- .start_evloop ⇒ Object
-
.start_service(uri = nil, front = nil, config = nil) ⇒ Object
This start_service emulates DRb#start_service.
-
.stop_all_servers ⇒ Object
Stop all servers.
Class Method Details
.start_drbserver(uri = nil, front = nil, config = nil) ⇒ Object
This is the ‘bare bones’ start_service which can be used to start a DRb service from within an existing event loop.
708 709 710 711 712 713 |
# File 'lib/emdrb/emdrb.rb', line 708 def start_drbserver(uri=nil, front=nil, config=nil) serv = DRbServer.new(uri, front, config) serv.start_drb_server DRb.regist_server(serv) return(serv) end |
.start_evloop ⇒ Object
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 |
# File 'lib/emdrb/emdrb.rb', line 725 def start_evloop unless EventMachine::reactor_running? q = Queue.new @eventloop = Thread.new do begin EventMachine::run do # Start an empty event loop. The DRb server(s) will be started # by EM#next_tick calls. Just put a dummy value into the queue # so that the calling thread will resume execution once this # event thread actually starts the loop. q << 1 end ensure # close all servers if the event loop ends for whatever reason self.stop_all_servers end end q.shift end end |
.start_service(uri = nil, front = nil, config = nil) ⇒ Object
This start_service emulates DRb#start_service.
750 751 752 753 754 755 756 757 758 759 |
# File 'lib/emdrb/emdrb.rb', line 750 def start_service(uri=nil, front=nil, config=nil) DRb.start_evloop queue = Queue.new EventMachine::next_tick do queue << self.start_drbserver(uri, front, config) end serv = queue.shift @primary_server = serv return(serv) end |
.stop_all_servers ⇒ Object
Stop all servers.
718 719 720 721 722 |
# File 'lib/emdrb/emdrb.rb', line 718 def stop_all_servers @server.each do |uri,srv| srv.stop_service end end |