Improve thread pool names

This commit is contained in:
James Seibel
2023-06-14 19:42:16 -05:00
parent 2ab16b1fe5
commit b2196448f7
7 changed files with 15 additions and 12 deletions
@@ -38,7 +38,7 @@ public class ColumnRenderBufferBuilder
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
public static ExecutorService bufferUploaderThreadPool = ThreadUtil.makeSingleThreadPool("ColumnBufferUploader");
public static ExecutorService bufferUploaderThreadPool = ThreadUtil.makeSingleThreadPool("Column Buffer Uploader");
public static ExecutorService bufferBuilderThreadPool;
private static ConfigChangeListener<Integer> configListener;
@@ -382,7 +382,7 @@ public class ColumnRenderBufferBuilder
}
public static void setThreadPoolSize(int threadPoolSize)
{
bufferBuilderThreadPool = ThreadUtil.makeThreadPool(threadPoolSize, "BufferBuilder");
bufferBuilderThreadPool = ThreadUtil.makeThreadPool(threadPoolSize, "Buffer Builder");
maxNumberOfConcurrentCalls = threadPoolSize * MAX_NUMBER_OF_CONCURRENT_CALLS_PER_THREAD;
}
@@ -87,7 +87,7 @@ public class DataRenderTransformer
setThreadPoolSize(Config.Client.Advanced.MultiThreading.numberOfDataConverterThreads.get());
}
}
public static void setThreadPoolSize(int threadPoolSize) { transformerThreadPool = ThreadUtil.makeThreadPool(threadPoolSize, "Data/Render Transformer"); }
public static void setThreadPoolSize(int threadPoolSize) { transformerThreadPool = ThreadUtil.makeThreadPool(threadPoolSize, "Full/Render Data Transformer"); }
/**
* Stops any executing tasks and destroys the executor. <br>
@@ -32,7 +32,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
private final ExecutorService renderCacheThread = ThreadUtil.makeSingleThreadPool("RenderCacheThread");
private final ExecutorService fileHandlerThreadPool = ThreadUtil.makeSingleThreadPool("Render Source File Handler");
private final ConcurrentHashMap<DhSectionPos, RenderMetaDataFile> filesBySectionPos = new ConcurrentHashMap<>();
private final IDhClientLevel level;
@@ -160,7 +160,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider
public CompletableFuture<ColumnRenderSource> readAsync(DhSectionPos pos)
{
// don't continue if the handler has been shut down
if (this.renderCacheThread.isTerminated())
if (this.fileHandlerThreadPool.isTerminated())
{
return CompletableFuture.completedFuture(null);
}
@@ -205,7 +205,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider
}
}
return metaFile.loadOrGetCachedDataSourceAsync(this.renderCacheThread, this.level).handle(
return metaFile.loadOrGetCachedDataSourceAsync(this.fileHandlerThreadPool, this.level).handle(
(renderSource, exception) ->
{
if (exception != null)
@@ -289,7 +289,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider
ArrayList<CompletableFuture<Void>> futures = new ArrayList<>();
for (RenderMetaDataFile metaFile : this.filesBySectionPos.values())
{
futures.add(metaFile.flushAndSave(this.renderCacheThread));
futures.add(metaFile.flushAndSave(this.fileHandlerThreadPool));
}
return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]))
@@ -423,7 +423,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider
ArrayList<CompletableFuture<Void>> futures = new ArrayList<>();
for (RenderMetaDataFile metaFile : this.filesBySectionPos.values())
{
futures.add(metaFile.flushAndSave(this.renderCacheThread));
futures.add(metaFile.flushAndSave(this.fileHandlerThreadPool));
}
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
}
@@ -44,7 +44,7 @@ public class SubDimensionLevelMatcher implements AutoCloseable
public static final ConfigBasedLogger LOGGER = new ConfigBasedLogger(LogManager.getLogger(),
() -> Config.Client.Advanced.Logging.logFileSubDimEvent.get());
private final ExecutorService matcherThread = ThreadUtil.makeSingleThreadPool("Level-To-File-Matcher");
private final ExecutorService matcherThread = ThreadUtil.makeSingleThreadPool("Sub Dimension Matcher");
private SubDimensionPlayerData playerData = null;
private SubDimensionPlayerData firstSeenPlayerData = null;
@@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit;
import com.seibel.lod.core.config.Config;
import com.seibel.lod.core.logging.ConfigBasedLogger;
import com.seibel.lod.core.logging.DhLoggerBuilder;
import com.seibel.lod.core.util.ThreadUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.glfw.GLFW;
@@ -69,7 +70,7 @@ public class GLProxy
private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
private ExecutorService workerThread = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat(GLProxy.class.getSimpleName() + "-Worker-Thread").build());
private ExecutorService workerThread = ThreadUtil.makeSingleThreadPool("GL Proxy Worker");
private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName());
public static final ConfigBasedLogger GL_LOGGER = new ConfigBasedLogger(LogManager.getLogger(GLProxy.class),
@@ -23,7 +23,8 @@ public class DhClientServerWorld extends AbstractDhWorld implements IDhClientWor
private final HashSet<DhClientServerLevel> dhLevels;
public final LocalSaveStructure saveStructure;
public ExecutorService dhTickerThread = ThreadUtil.makeSingleThreadPool("DHTickerThread", 2);
// TODO why does this executor have 2 threads?
public ExecutorService dhTickerThread = ThreadUtil.makeSingleThreadPool("DH Client Server World Ticker Thread", 2);
public EventLoop eventLoop = new EventLoop(this.dhTickerThread, this::_clientTick); //TODO: Rate-limit the loop
public F3Screen.DynamicMessage f3Message;
@@ -22,7 +22,8 @@ public class DhClientWorld extends AbstractDhWorld implements IDhClientWorld
private final HashMap<IClientLevelWrapper, DhClientLevel> levels;
public final ClientOnlySaveStructure saveStructure;
public ExecutorService dhTickerThread = ThreadUtil.makeSingleThreadPool("DHTickerThread", 2);
// TODO why does this executor have 2 threads?
public ExecutorService dhTickerThread = ThreadUtil.makeSingleThreadPool("DH Client World Ticker Thread", 2);
public EventLoop eventLoop = new EventLoop(this.dhTickerThread, this::_clientTick);