Sha256: 34e05eb0380c2f5102c7507014d1aea1e8bcd446f057d65891cb0a097e5a3f14

Contents?: true

Size: 812 Bytes

Versions: 10

Compression:

Stored size: 812 Bytes

Contents

require 'mizuno/server'
require 'rack/builder'
require 'msgpack-rpc-over-http-jruby'

require_relative 'handler'

module Norikra::RPC
  class HTTP
    #TODO Xmx of mizuno/jetty
    attr_accessor :host, :port, :threads
    attr_accessor :engine, :mizuno, :thread

    def initialize(opts={})
      @engine = opts[:engine]
      @host = opts[:host]
      @port = opts[:port]
      handler = Norikra::RPC::Handler.new(@engine)
      @app = Rack::Builder.new {
        run MessagePack::RPCOverHTTP::Server.app(handler)
      }
    end

    def start
      @thread = Thread.new do
        @mizuno = Mizuno::Server.new
        @mizuno.run(@app, :embedded => true, :threads => 5, :port => @port, :host => @host)
      end
    end

    def stop
      @mizuno.stop
      @thread.kill
      @thread.join
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
norikra-0.0.11-java lib/norikra/rpc/http.rb
norikra-0.0.10-java lib/norikra/rpc/http.rb
norikra-0.0.9-java lib/norikra/rpc/http.rb
norikra-0.0.8-java lib/norikra/rpc/http.rb
norikra-0.0.7-java lib/norikra/rpc/http.rb
norikra-0.0.6-java lib/norikra/rpc/http.rb
norikra-0.0.5-java lib/norikra/rpc/http.rb
norikra-0.0.4-java lib/norikra/rpc/http.rb
norikra-0.0.3-java lib/norikra/rpc/http.rb
norikra-0.0.1-java lib/norikra/rpc/http.rb