Created
August 17, 2022 15:05
-
-
Save kylec32/a28de4e096fc542e4ee2b13c1236f108 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void process(ExecutorService executorService) { | |
long startTime = System.currentTimeMillis(); | |
try (ExecutorService executor = executorService) { | |
for (String url : getUrls()) { | |
executor.execute(() -> { | |
try { | |
new URL("https://" + url).getContent(); | |
System.out.println("Finished processing: " + url); | |
} catch (IOException e) { | |
} | |
}); | |
} | |
} | |
System.out.println("Processing time: " + (System.currentTimeMillis() - startTime)/1000.0f + " seconds"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment