Class: Pixo::Rpc::ApplicationService

Inherits:
Service
  • Object
show all
Defined in:
lib/pixo/rpc/application_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Service

#live_request_count, #request, #run, #shutdown

Constructor Details

#initialize(reader_pipe, writer_pipe, app, latch) ⇒ ApplicationService

Returns a new instance of ApplicationService.



5
6
7
8
9
10
11
# File 'lib/pixo/rpc/application_service.rb', line 5

def initialize(reader_pipe, writer_pipe, app, latch)
  super(reader_pipe, writer_pipe)
  @application = app

  @latch = latch
  @service_thread = Thread.new { self.thread_run }
end

Instance Attribute Details

#applicationObject (readonly)

Returns the value of attribute application.



3
4
5
# File 'lib/pixo/rpc/application_service.rb', line 3

def application
  @application
end

Instance Method Details

#thread_runObject



13
14
15
16
17
18
19
20
# File 'lib/pixo/rpc/application_service.rb', line 13

def thread_run
  @latch.wait(10)
  run
rescue
  STDERR.puts $!.inspect
ensure
  application.shutdown
end