Change thread pool type

Replace cached thread pool (Executors.newCachedThreadPool()) with single thread pool (Executors.newSingleThreadExecutor()). The single thread executor is more efficient for lazy asynchronous operations.
This commit is contained in:
A248 2019-11-23 11:07:18 -05:00 committed by GitHub
parent f2bc472f6f
commit a9e06eab79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ import java.util.Scanner;
public class MineSkinFetcher {
private static final String MINESKIN_API = "https://api.mineskin.org/get/id/";
private static final ExecutorService threadPool = Executors.newCachedThreadPool();
private static final ExecutorService threadPool = Executors.newSingleThreadExecutor();
public static void fetchSkinFromIdAsync(int id, Callback callback) {
threadPool.execute(() -> {