private void acquireLockIfNeed()

in teamcity-symbol-server/src/main/java/jetbrains/buildServer/symbols/DownloadSymbolsController.java [261:273]


      private void acquireLockIfNeed() throws InterruptedException, TimeoutException {
        if (lockRequested) {
          return;
        }

        final int timeout = TeamCityProperties.getInteger(SymbolsConstants.SYMBOLS_SERVER_CACHE_ACQUIRE_LOCK_TIMEOUT, 150);
        if (myConcurrentDataRequestSemaphore.tryAcquire(timeout, TimeUnit.SECONDS)) {
          lockRequested = true;
        } else {
          LOG.warn("Could not acquire read metadata lock during " + timeout + " sec");
          throw new TimeoutException("Could not acquire read metadata lock during " + timeout + " sec");
        }
      }