def timerExpired(metadata)
      if metadata.is_a?(Array) && metadata[0] == :manage_peers
        managePeers(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :request_blocks
        requestBlocks(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :check_piece_manager
        checkPieceManagerResults(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :handshake_timeout
        handleHandshakeTimeout(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :removetorrent
        handleRemoveTorrent(metadata[1], metadata[2])
      elsif metadata.is_a?(Array) && metadata[0] == :pausetorrent
        handlePause(metadata[1], metadata[2])
      elsif metadata.is_a?(Array) && metadata[0] == :get_torrent_data
        @torrentData.each do |k,v|
          begin
            if metadata[3].nil? || k == metadata[3]
              v = TorrentDataDelegate.new(v, self)
              metadata[1][k] = v
            end
          rescue
            @logger.error "Error building torrent data response for user: #{$!}"
            @logger.error "#{$!.backtrace.join("\n")}"
          end
        end
        metadata[2].signal
      elsif metadata.is_a?(Array) && metadata[0] == :update_torrent_data
        delegate = metadata[1]
        if ! @torrentData.has_key?(infoHash)
          delegate.state = :deleted 
        else
          delegate.internalRefresh
        end
        metadata[2].signal
      elsif metadata.is_a?(Array) && metadata[0] == :request_metadata_pieces
        requestMetadataPieces(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :check_metadata_piece_manager
        checkMetadataPieceManagerResults(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :runproc
        metadata[1].call
      else
        @logger.info "Unknown timer #{metadata} expired."
      end
    end
def timerExpired(metadata)
      if metadata.is_a?(Array) && metadata[0] == :manage_peers
        managePeers(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :request_blocks
        requestBlocks(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :check_piece_manager
        checkPieceManagerResults(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :handshake_timeout
        handleHandshakeTimeout(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :removetorrent
        handleRemoveTorrent(metadata[1], metadata[2])
      elsif metadata.is_a?(Array) && metadata[0] == :pausetorrent
        handlePause(metadata[1], metadata[2])
      elsif metadata.is_a?(Array) && metadata[0] == :get_torrent_data
        @torrentData.each do |k,v|
          begin
            if metadata[3].nil? || k == metadata[3]
              v = TorrentDataDelegate.new(v, self)
              metadata[1][k] = v
            end
          rescue
            @logger.error "Error building torrent data response for user: #{$!}"
            @logger.error "#{$!.backtrace.join("\n")}"
          end
        end
        metadata[2].signal
      elsif metadata.is_a?(Array) && metadata[0] == :update_torrent_data
        delegate = metadata[1]
        if ! @torrentData.has_key?(infoHash)
          delegate.state = :deleted 
        else
          delegate.internalRefresh
        end
        metadata[2].signal
      elsif metadata.is_a?(Array) && metadata[0] == :request_metadata_pieces
        requestMetadataPieces(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :check_metadata_piece_manager
        checkMetadataPieceManagerResults(metadata[1])
      elsif metadata.is_a?(Array) && metadata[0] == :runproc
        metadata[1].call
      else
        @logger.info "Unknown timer #{metadata} expired."
      end
    end
Reactor method called when a scheduled timer expires.