Fixed: Включена многопоточность Updatable
This commit is contained in:
@@ -341,10 +341,12 @@ public class InnerCoreServer {
|
||||
}
|
||||
|
||||
public void start() {
|
||||
for(File file : Objects.requireNonNull(new File(InnerCoreServer.dataPath, "behavior_packs").listFiles())) {
|
||||
BehaviorPack pack = new BehaviorPack(file.getAbsolutePath());
|
||||
pack.load();
|
||||
}
|
||||
try{
|
||||
for(File file : Objects.requireNonNull(new File(InnerCoreServer.dataPath, "behavior_packs").listFiles())) {
|
||||
BehaviorPack pack = new BehaviorPack(file.getAbsolutePath());
|
||||
pack.load();
|
||||
}
|
||||
}catch (Exception e){}
|
||||
}
|
||||
|
||||
public static Object getProperty(String variable) {
|
||||
@@ -472,6 +474,10 @@ public class InnerCoreServer {
|
||||
return getPropertyInt("max-packet-sending", 200);
|
||||
}
|
||||
|
||||
public static int getAdditionalThreadCount() {
|
||||
return getPropertyInt("threading_additional_thread_count", 16);
|
||||
}
|
||||
|
||||
public static boolean isUnsupportedOptionsAllowed() {
|
||||
return getPropertyBoolean("allow-unsupported-options", false);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public class NativeCallback {
|
||||
// read config and setup thread priorities
|
||||
private static void setupThreadPriorityFromConfig() {
|
||||
TickExecutor.getInstance()
|
||||
.setAdditionalThreadCount(InnerCoreConfig.getInt("threading.additional_thread_count", 0));
|
||||
.setAdditionalThreadCount(InnerCoreServer.getAdditionalThreadCount());
|
||||
// we divide by 4 to fit into standard 1-40 priority range
|
||||
TickExecutor.getInstance()
|
||||
.setAdditionalThreadPriority(InnerCoreConfig.getInt("threading.additional_thread_priority", 12) / 4);
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TickExecutor {
|
||||
}
|
||||
|
||||
public void setAdditionalThreadCount(int count) {
|
||||
count = Math.max(0, Math.min(7, count));
|
||||
count = Math.max(0, Math.min(16, count));
|
||||
if (threadCount != count) {
|
||||
threadCount = count;
|
||||
if (executor != null) {
|
||||
|
||||
Reference in New Issue
Block a user