# File lib/stomp_server/queue.rb, line 5
  def initialize(directory='.stompserver', delete_empty=true)
    @stompid = StompServer::StompId.new
    @delete_empty = delete_empty
    @directory = directory
    Dir.mkdir(@directory) unless File.directory?(@directory)
    if File.exists?("#{@directory}/qinfo")
      qinfo = Hash.new
      File.open("#{@directory}/qinfo", "rb") { |f| qinfo = Marshal.load(f.read)}
      @queues = qinfo[:queues]
      @frames = qinfo[:frames]
      @queues = Hash.new
      @frames = Hash.new

    @queues.keys.each do |dest|
      puts "Queue #{dest} size=#{@queues[dest][:size]} enqueued=#{@queues[dest][:enqueued]} dequeued=#{@queues[dest][:dequeued]}" if $DEBUG

    puts "Queue initialized in #{@directory}"

    # Cleanup dead queues and save the state of the queues every so often.  Alternatively we could save the queue state every X number
    # of frames that are put in the queue.  Should probably also read it after saving it to confirm integrity.
    # Removed, this badly corrupt the queue when stopping with messages
    #EventMachine::add_periodic_timer 1800, proc {@queues.keys.each {|dest| close_queue(dest)};save_queue_state }