Class: Nonnative::Server

Inherits:
Service show all
Defined in:
lib/nonnative/server.rb

Direct Known Subclasses

GRPCServer, HTTPServer

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Service

#name

Constructor Details

#initialize(service) ⇒ Server



7
8
9
10
11
# File 'lib/nonnative/server.rb', line 7

def initialize(service)
  @proxy = Nonnative::ProxyFactory.create(service)

  super service
end

Instance Attribute Details

#proxyObject (readonly)

Returns the value of attribute proxy.



5
6
7
# File 'lib/nonnative/server.rb', line 5

def proxy
  @proxy
end

Instance Method Details

#startObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/nonnative/server.rb', line 13

def start
  unless thread
    proxy.start
    @thread = Thread.new { perform_start }

    wait_start
  end

  object_id
end

#stopObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/nonnative/server.rb', line 24

def stop
  if thread
    perform_stop
    thread.terminate
    proxy.stop

    @thread = nil
    wait_stop
  end

  object_id
end