Class: Thrift::SimpleServer

Inherits:
BaseServer show all
Defined in:
lib/thrift/server/simple_server.rb

Instance Method Summary collapse

Methods inherited from BaseServer

#initialize

Constructor Details

This class inherits a constructor from Thrift::BaseServer

Instance Method Details

#serveObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/thrift/server/simple_server.rb', line 22

def serve
  begin
    @server_transport.listen
    loop do
      client = @server_transport.accept
      trans = @transport_factory.get_transport(client)
      prot = @protocol_factory.get_protocol(trans)
      begin
        loop do
          @processor.process(prot, prot)
        end
      rescue Thrift::TransportException, Thrift::ProtocolException
      ensure
        trans.close
      end
    end
  ensure
    @server_transport.close
  end
end