def add(worker_klass, num_workers, worker_options={})
      ModernTimes.logger.info "Starting #{worker_klass} with #{num_workers} workers with options #{worker_options.inspect}"
      unless worker_klass.kind_of?(Class)
        begin
          worker_klass = Object.const_get(worker_klass.to_s)
        rescue
          raise "Invalid class: #{worker_klass}"
        end
      end
      if @allowed_workers && !@allowed_workers.include?(worker_klass)
        raise "Error: #{worker_klass.name} is not an allowed worker"
      end
      supervisor = worker_klass.create_supervisor(self, worker_options)
      raise "A supervisor with name #{supervisor.name} already exists" if find_supervisor(supervisor.name)
      @supervisors << supervisor
      supervisor.worker_count = num_workers
      if @jmx_server
        mbean = supervisor.create_mbean(@domain)
        @jmx_server.register_mbean(mbean, "#{@domain}:worker=#{supervisor.name},type=Worker")
      end
      ModernTimes.logger.info "Started #{worker_klass.name} named #{supervisor.name} with #{num_workers} workers"
    rescue Exception => e
      ModernTimes.logger.error "Exception trying to add #{worker_klass}: #{e.message}\n\t#{e.backtrace.join("\n\t")}"
      raise
    rescue java.lang.Exception => e
      ModernTimes.logger.error "Java exception trying to add #{worker_klass.name}: #{e.message}\n\t#{e.backtrace.join("\n\t")}"
      raise
    end
def add(worker_klass, num_workers, worker_options={})
      ModernTimes.logger.info "Starting #{worker_klass} with #{num_workers} workers with options #{worker_options.inspect}"
      unless worker_klass.kind_of?(Class)
        begin
          worker_klass = Object.const_get(worker_klass.to_s)
        rescue
          raise "Invalid class: #{worker_klass}"
        end
      end
      if @allowed_workers && !@allowed_workers.include?(worker_klass)
        raise "Error: #{worker_klass.name} is not an allowed worker"
      end
      supervisor = worker_klass.create_supervisor(self, worker_options)
      raise "A supervisor with name #{supervisor.name} already exists" if find_supervisor(supervisor.name)
      @supervisors << supervisor
      supervisor.worker_count = num_workers
      if @jmx_server
        mbean = supervisor.create_mbean(@domain)
        @jmx_server.register_mbean(mbean, "#{@domain}:worker=#{supervisor.name},type=Worker")
      end
      ModernTimes.logger.info "Started #{worker_klass.name} named #{supervisor.name} with #{num_workers} workers"
    rescue Exception => e
      ModernTimes.logger.error "Exception trying to add #{worker_klass}: #{e.message}\n\t#{e.backtrace.join("\n\t")}"
      raise
    rescue java.lang.Exception => e
      ModernTimes.logger.error "Java exception trying to add #{worker_klass.name}: #{e.message}\n\t#{e.backtrace.join("\n\t")}"
      raise
    end
Constructs a manager.  Accepts a hash of config values
   allowed_workers - array of allowed worker classes.  For a rails project, this will be set to the
     classes located in the app/workers directory which are a kind_of? ModernTimes::Base::Worker
   dummy_host - name to use for host as defined by the worker_file.  For a rails project, this will be the value of Rails.env
     such that a set of workers can be defined for development without having to specify the hostname.  For production, a set of
     workers could be defined under production or specific workers for each host name