code: public synchronized TrackedTorrent announce(TrackedTorrent torrent) {
      TrackedTorrent existing = myTorrentsRepository.getTorrent(torrent.getHexInfoHash());
  
      if (existing != null) {
        logger.warn("Tracker already announced torrent with hash {}.", existing.getHexInfoHash());
        return existing;
      }
  
      myTorrentsRepository.putIfAbsent(torrent.getHexInfoHash(), torrent);
      logger.info("Registered new torrent with hash {}.", torrent.getHexInfoHash());
      return torrent;
    }
docs: Announce a new torrent on this tracker.
  <p>
  <p>
  The fact that torrents must be announced here first makes this tracker a
  closed BitTorrent tracker: it will only accept clients for torrents it
  knows about, and this list of torrents is managed by the program
  instrumenting this Tracker class.
  </p>
  
  @param torrent The Torrent object to start tracking.
  @return The torrent object for this torrent on this tracker. This may be
  different from the supplied Torrent object if the tracker already
  contained a torrent with the same hash.