Class: Thrift::ThreadedServer

Inherits:
BaseServer show all
Defined in:
lib/thrift/server/threaded_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



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/thrift/server/threaded_server.rb', line 24

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

#to_sObject



47
48
49
# File 'lib/thrift/server/threaded_server.rb', line 47

def to_s
  "threaded(#{super.to_s})"
end