public void run()

in deploy-runner-agent/src/main/java/jetbrains/buildServer/deployer/agent/ftp/InterruptibleUploadProcess.java [75:132]


  public void run() {
    myRetryCount++;
    try {
      if (!StringUtil.isEmpty(myPath)) {
        createPath(myPath);
        checkResult(myClient.changeWorkingDirectory(myPath));
      }

      final String remoteRoot = myClient.printWorkingDirectory();

      for (ArtifactsCollection artifactsCollection : myArtifacts) {
        int count = 0;
        for (Map.Entry<File, String> fileStringEntry : artifactsCollection.getFilePathMap().entrySet()) {
          final File source = fileStringEntry.getKey();
          final String destinationDir = fileStringEntry.getValue();

          if (StringUtil.isNotEmpty(destinationDir)) {
            createPath(destinationDir);
            checkResult(myClient.changeWorkingDirectory(destinationDir));
          }
          LOG.debug("Transferring [" + source.getAbsolutePath() + "] to [" + destinationDir + "] under [" + remoteRoot + "]");
          if (checkIsInterrupted())
            throw new FailureDetectedException("Process has been interrupted.");
          InputStream inputStream = null;
          try {
            if (myIsAutoType) {
              checkResult(myClient.setFileType(detectType(source.getName())));
            }
            inputStream = new FileInputStream(source);
            checkResult(myClient.storeFile(source.getName(), inputStream));
          } finally {
            if (inputStream != null) {
              inputStream.close();
            }
          }
          checkResult(myClient.changeWorkingDirectory(remoteRoot));
          LOG.debug("done transferring [" + source.getAbsolutePath() + "]");
          count++;
          if (count < BY_FILE_LOGGING_THRESHOLD) {
            myLogger.message("Uploaded [" + source.getPath() + "] (" + StringUtil.formatFileSize(source) + ")");
          } else if (count == BY_FILE_LOGGING_THRESHOLD) {
            myLogger.message("< and continued >");
          }
          if (checkIsInterrupted())
            throw new FailureDetectedException("Process has been interrupted.");
        }
        myLogger.message("Uploaded [" + count + "] files for [" + artifactsCollection.getSourcePath() + "] pattern");
      }
      myFinishStatus.set(BuildFinishedStatus.FINISHED_SUCCESS);
    } catch (FailureDetectedException | IOException t) {
      if (myRetryCount == 1 && myClient.getReplyCode() == FTP_REPLY_CODE_DATA_CONNECTION_MUST_BE_ENCRYPTED) {
        throw new RetryWithPrivateSettingsException();
      }
      logBuildProblem(myLogger, t.getMessage());
      LOG.debug(t.getMessage(), t);
      myFinishStatus.set(BuildFinishedStatus.FINISHED_FAILED);
    }
  }