require RUBY_VERSION < '1.9' && RUBY_PLATFORM != 'java' ? 'system_timer' : 'timeout'
SystemTimer ||= Timeout

module Rack
  class Timeout
    @timeout = 15
    class << self
      attr_accessor :timeout
    end

    def initialize(app)
      @app = app
    end

    def call(env)
      SystemTimer.timeout(self.class.timeout, ::Timeout::Error) { @app.call(env) }
    end

  end
end

require RUBY_VERSION < '1.9' && RUBY_PLATFORM != 'java' ? 'system_timer' : 'timeout'
Timeout ||= SystemTimer

module Rack
  class Timeout
    @timeout = 15
    class << self
      attr_accessor :timeout
    end

    def initialize(app)
      @app = app
    end

    def call(env)
      ::Timeout.timeout(self.class.timeout, ::Timeout::Error) { @app.call(env) }
    end

  end
end

Swap around Timeout and SystemTimer for clarity since Timeout is what most people actually end up with nowadays. This doesn't really change anything functionality-wise.
Swap around Timeout and SystemTimer for clarity since Timeout is what most people actually end up with nowadays. This doesn't really change anything functionality-wise.
