@NotNull private Map<String, Ref> getRemoteRefs(@NotNull Repository db, @NotNull GitVcsRoot gitRoot) throws Exception { long retryInterval = myConfig.getConnectionRetryIntervalMillis(); int attemptsLeft = myConfig.getConnectionRetryAttempts(); while (true) { final long start = System.currentTimeMillis(); Transport transport = null; FetchConnection connection = null; try { transport = myTransportFactory.createTransport( db, gitRoot.getRepositoryFetchURL(), gitRoot.getAuthSettings()); connection = transport.openFetch(); return connection.getRefsMap(); } catch (NotSupportedException nse) { throw friendlyNotSupportedException(gitRoot, nse); } catch (TransportException te) { attemptsLeft--; if (isRecoverable(te) && attemptsLeft > 0) { LOG.warn( "List remote refs failed: " + te.getMessage() + ", " + attemptsLeft + " attempt(s) left"); } else { throw friendlyTransportException(te, gitRoot); } } catch (WrongPassphraseException e) { throw new VcsException(e.getMessage(), e); } finally { if (connection != null) connection.close(); if (transport != null) transport.close(); final long finish = System.currentTimeMillis(); PERFORMANCE_LOG.debug( "[getRemoteRefs] repository: " + LogUtil.describe(gitRoot) + ", took " + (finish - start) + "ms"); } Thread.sleep(retryInterval); retryInterval *= 2; } }
private void setStreamFileThreshold() { int thresholdBytes = myConfig.getStreamFileThresholdMb() * WindowCacheConfig.MB; if (thresholdBytes <= 0) { // Config returns a threshold > 0, threshold in bytes can became non-positive due to integer // overflow. // Since users set a value larger than the max possible one, most likely they wanted a // threshold // to be large, so use maximum possible value. thresholdBytes = Integer.MAX_VALUE; } GitServerUtil.configureStreamFileThreshold(thresholdBytes); }