public VmwareCloudImage()

in cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/VmwareCloudImage.java [57:85]


  public VmwareCloudImage(@NotNull final VMWareApiConnector apiConnector,
                          @NotNull final VmwareCloudImageDetails imageDetails,
                          @NotNull final CloudAsyncTaskExecutor asyncTaskExecutor,
                          @NotNull final File idxStorage,
                          @NotNull final CloudProfile profile) {
    super(imageDetails.getSourceId(), imageDetails.getSourceId());
    myImageDetails = imageDetails;
    myApiConnector = apiConnector;
    myAsyncTaskExecutor = asyncTaskExecutor;
    myProfile = profile;
    myActualSourceState = new AtomicReference<>();
    myIdxFile = new File(idxStorage, imageDetails.getSourceId() + ".idx");
    try {
      if (!myIdxFile.exists()) {
        myIdxCounter.set(1);
        myIdxTouched.set(true);
        storeIdx();
      } else {
        myIdxCounter.set(Integer.parseInt(FileUtil.readText(myIdxFile)));
      }
    } catch (Exception e) {
      LOG.warnAndDebugDetails(String.format("Unable to process idx file '%s'. Will reset the index for " + imageDetails.getSourceId(), myIdxFile.getAbsolutePath()), e);
      myIdxCounter.set(1);
    }

    asyncTaskExecutor.scheduleWithFixedDelay("Store idx", ()->{
      storeIdx();
    }, 5000, 5000, TimeUnit.MILLISECONDS);
  }