Dynamic thread count
This commit is contained in:
@@ -9,7 +9,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
|
||||
public class AkarinAsyncExecutor {
|
||||
private static final ExecutorService singleExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Akarin Single Async Executor Thread - %1$d").build());
|
||||
private static final ExecutorService asyncExecutor = Executors.newFixedThreadPool(4, new ThreadFactoryBuilder().setNameFormat("Akarin Async Executor Thread - %1$d").build());
|
||||
private static final ExecutorService asyncExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() / 4, new ThreadFactoryBuilder().setNameFormat("Akarin Async Executor Thread - %1$d").build());
|
||||
|
||||
/**
|
||||
* Posts a task to be executed asynchronously in a single thread
|
||||
|
||||
@@ -96,6 +96,8 @@ public class AkarinUserCache {
|
||||
PropertyMap offlineProperties = offlineProfile.getProperties();
|
||||
for (Property property : gameprofile.getProperties().get("textures"))
|
||||
offlineProperties.put("textures", property);
|
||||
|
||||
callback.onProfileLookupSucceeded(offlineProfile);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,7 +109,11 @@ public class AkarinUserCache {
|
||||
profileRepo.findProfilesByNames(new String[] { keyUsername }, Agent.MINECRAFT, skinHandler);
|
||||
};
|
||||
|
||||
AkarinAsyncExecutor.scheduleAsyncTask(lookupTextures);
|
||||
if (async)
|
||||
AkarinAsyncExecutor.scheduleAsyncTask(lookupTextures);
|
||||
else
|
||||
lookupTextures.run();
|
||||
} else {
|
||||
callback.onProfileLookupSucceeded(offlineProfile);
|
||||
}
|
||||
}
|
||||
|
||||
Submodule work/Paper updated: 25e5bfe669...def0033929
Reference in New Issue
Block a user