public synchronized URLContentRetriever getTransport()

in s3-artifact-storage-agent/src/main/java/jetbrains/buildServer/artifacts/s3/download/S3ArtifactTransportFactory.java [167:200]


  public synchronized URLContentRetriever getTransport(@NotNull Map<String, String> parameters) {
    if (myIsFactoryShutdown) {
      LOGGER.warn("Attempted to create S3 artifact transport on shut down factory");
      return null;
    }

    AgentRunningBuild runningBuild;
    try {
      runningBuild = myCurrentBuildTracker.getCurrentBuild();
    } catch (NoRunningBuildException e) {
      LOGGER.warn("Attempted to create S3 artifact transport outside the scope of a running build");
      return null;
    }

    S3DownloadConfiguration configuration = ensurePreparedToBuild(runningBuild); // configuration, executor and clients map are prepared until we hold the lock
    boolean parallelDownloadEnabled = configuration.isParallelDownloadEnabled();
    boolean storageS3Compatible = configuration.isS3CompatibleStorage();
    boolean parallelDownloadForced = configuration.isParallelDownloadForced();
    long buildId = runningBuild.getBuildId();
    if (!parallelDownloadEnabled || !(storageS3Compatible || parallelDownloadForced)) {
      LOGGER.debug(String.format(
        "Will not create S3 artifact transport, build ID = %s, parallel download enabled = %s, storage is S3 compatible = %s, parallel download forced = %s",
        buildId, parallelDownloadEnabled, storageS3Compatible, parallelDownloadForced
      ));
      return null;
    }

    LOGGER.debug(String.format("Creating S3 artifact transport, build ID = %s", buildId));
    HttpClient client = findOrCreateClient(parameters, configuration);
    String serverUrl = parameters.get(DependencyHttpHelper.SERVER_URL_PARAM);
    ExecutorService executor = this.myExecutor;
    Objects.requireNonNull(executor, "Executor is null");
    return new S3ArtifactTransport(serverUrl, client, executor, myDependencyHttpHelper, configuration, runningBuild, myParallelDownloadStrategiesByName);
  }