File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
core/src/main/java/net/adoptopenjdk/icedteaweb/resources/downloader Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -132,11 +132,7 @@ private CompletableFuture<Resource> downloadFrom(final URL url) {
132132 }
133133
134134 private Resource tryDownloading (final URL downloadFrom ) throws IOException {
135- try {
136- final int httpsRequestInterval = getTimeValue (ConfigurationConstants .KEY_HTTPCONNECTION_REQUEST_INTERVAL );
137- Thread .sleep (httpsRequestInterval );
138- } catch (InterruptedException ie ) {
139- }
135+ ensureRequestInterval ();
140136 DownloadDetails downloadDetails = null ;
141137 try (final CloseableConnection connection = getDownloadConnection (downloadFrom )) {
142138 downloadDetails = getDownloadDetails (connection );
@@ -163,6 +159,16 @@ private Resource tryDownloading(final URL downloadFrom) throws IOException {
163159 }
164160 }
165161
162+ private void ensureRequestInterval () {
163+ final int httpsRequestInterval = getTimeValue (ConfigurationConstants .KEY_HTTPCONNECTION_REQUEST_INTERVAL );
164+ if (httpsRequestInterval > 0 ) {
165+ try {
166+ Thread .sleep (httpsRequestInterval );
167+ } catch (InterruptedException ignored ) {
168+ }
169+ }
170+ }
171+
166172 private CloseableConnection getDownloadConnection (final URL location ) throws IOException {
167173 final Map <String , String > requestProperties = new HashMap <>();
168174 requestProperties .put (ACCEPT_ENCODING_HEADER , PACK_200_OR_GZIP );
You can’t perform that action at this time.
0 commit comments