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:
parent
f2bc472f6f
commit
a9e06eab79
|
@ -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(() -> {
|
||||
|
|
Loading…
Reference in New Issue