require 'thread'
require 'open-uri'

class Http
  @@mutex = Mutex.new
  @@busy = false


  class << self
    include Processing::Proxy

    def mutex
      @@mutex
    end

    def get(uri)
      mutex.synchronize{ @@busy = true }
      response = open(uri).read
      mutex.synchronize{ @@busy = false }

      response
    end


    def busy?
      @@busy
    end
  end
end



require 'thread'
require 'open-uri'

class Http
  @@mutex = Mutex.new
  @@busy = false


  class << self
    include Processing::Proxy

    def mutex
      @@mutex
    end

    def get(uri)
      mutex.synchronize{ @@busy = true }
      response = nil
      begin
        response = open(uri).read
      rescue => e
        LinerNotes.logger.error "Couldn't get #{uri}: #{e}"
      end

      mutex.synchronize{ @@busy = false }

      response
    end


    def busy?
      @@busy
    end
  end
end



Handle errors from remote URLs
Handle errors from remote URLs
