def run
      @stats[:start_time] = Time.now

      if @opts[:syslog_channel]
        begin
          require 'syslog_logger'
          @@logger = SyslogLogger.new(@opts[:syslog_channel])
        rescue LoadError
          # SyslogLogger isn't available, so we're just going to use Logger
        end
      end

      @@logger ||= case @opts[:logger]
                   when IO, String; Logger.new(@opts[:logger])
                   when Logger; @opts[:logger]
                   else; Logger.new(STDERR)
                   end

      begin
        @opts[:queue] = QueueCollection.new(@opts[:path])
      rescue InaccessibleQueuePath => e
        puts "Error: #{e.message}"
        exit 1
      end
      @@logger.level = @opts[:log_level] || Logger::ERROR

      @@logger.info "Starling STARTUP on #{@opts[:host]}:#{@opts[:port]}"

      EventMachine.epoll
      EventMachine.set_descriptor_table_size(4096)
      EventMachine.run do
        EventMachine.start_server(@opts[:host], @opts[:port], Handler, @opts)
      end

      # code here will get executed on shutdown:
      @opts[:queue].close
    end
def run
      @stats[:start_time] = Time.now

      if @opts[:syslog_channel]
        begin
          require 'syslog_logger'
          @@logger = SyslogLogger.new(@opts[:syslog_channel])
        rescue LoadError
          # SyslogLogger isn't available, so we're just going to use Logger
        end
      end

      @@logger ||= case @opts[:logger]
                   when IO, String; Logger.new(@opts[:logger])
                   when Logger; @opts[:logger]
                   else; Logger.new(STDERR)
                   end

      begin
        @opts[:queue] = QueueCollection.new(@opts[:path])
      rescue InaccessibleQueuePath => e
        puts "Error: #{e.message}"
        exit 1
      end
      @@logger.level = @opts[:log_level] || Logger::ERROR

      @@logger.info "Starling STARTUP on #{@opts[:host]}:#{@opts[:port]}"

      EventMachine.epoll
      EventMachine.set_descriptor_table_size(4096)
      EventMachine.run do
        EventMachine.start_server(@opts[:host], @opts[:port], Handler, @opts)
      end

      # code here will get executed on shutdown:
      @opts[:queue].close
    end
Initialize a new Starling server, but do not accept connections or
 process requests.

 +opts+ is as for +start+

 Start listening and processing requests.