public TorrentConfigurator()

in server/src/main/java/jetbrains/buildServer/torrent/TorrentConfigurator.java [47:80]


  public TorrentConfigurator(@NotNull final ServerPaths serverPaths,
                             @NotNull final RootUrlHolder rootUrlHolder,
                             @NotNull final XmlRpcHandlerManager xmlRpcHandlerManager) {
    myServerPaths = serverPaths;
    myRootUrlHolder = rootUrlHolder;
    File configFile = getConfigFile();
    if (!configFile.isFile()) {
      initConfigFile(configFile);
    }
    loadConfiguration(configFile);

    xmlRpcHandlerManager.addHandler(XmlRpcConstants.TORRENT_CONFIGURATION, this);

    myConfigurationWatcher = new TorrentConfigurationWatcher();
    myConfigurationWatcher.registerListener(new ChangeListener() {
      public void changeOccured(String requestor) {
        setTrackerEnabled(TeamCityProperties.getBooleanOrTrue(TRACKER_ENABLED));
        setTrackerUsesDedicatedPort(TeamCityProperties.getBoolean(TRACKER_DEDICATED_PORT));
        setMaxNumberOfSeededTorrents(TeamCityProperties.getInteger(MAX_NUMBER_OF_SEEDED_TORRENTS, DEFAULT_MAX_NUMBER_OF_SEEDED_TORRENTS));
        long newFileSize = getFileSizeThreshold();
        setFileSizeThresholdMb(newFileSize);
        setMaxConnectionsCount(TeamCityProperties.getInteger(MAX_INCOMING_CONNECTIONS, DEFAULT_MAX_CONNECTIONS));
        setTrackerTorrentExpireTimeoutSec(TeamCityProperties.getInteger(TRACKER_TORRENT_EXPIRE_TIMEOUT, DEFAULT_TRACKER_TORRENT_EXPIRE_TIMEOUT));
        setAnnounceIntervalSec(TeamCityProperties.getInteger(ANNOUNCE_INTERVAL, DEFAULT_ANNOUNCE_INTERVAL));
        setAnnounceUrl(TeamCityProperties.getProperty(ANNOUNCE_URL, myAnnounceUrl == null ? "" : myAnnounceUrl));
        final int defaultBufferSize = SystemInfo.isWindows ? DEFAULT_BUFFER_SIZE_WINDOWS : -1;
        setReceiveBufferSize(TeamCityProperties.getInteger(RECEIVE_BUFFER_SIZE, defaultBufferSize));
        setSendBufferSize(TeamCityProperties.getInteger(SEND_BUFFER_SIZE, defaultBufferSize));
      }
    });

    myConfigurationWatcher.registerChangeProvider(myConfigurationWatcher);
    myConfigurationWatcher.start();
  }