From 692fcebb11169ea19e20389cc82417a35b9b41e5 Mon Sep 17 00:00:00 2001 From: Kevin Ruland Date: Wed, 9 May 2012 02:00:54 +0000 Subject: [PATCH] Give the threads names to facilitate thread performance analysis. --- ...rentLoadingThrustCurveMotorSetDatabase.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java b/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java index a5f6006b9..3f6e9fcbb 100644 --- a/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java +++ b/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java @@ -6,6 +6,7 @@ import java.io.InputStream; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import net.sf.openrocket.database.ThrustCurveMotorSet; @@ -122,9 +123,22 @@ public class ConcurrentLoadingThrustCurveMotorSetDatabase extends ThrustCurveMot private BookKeeping() { - writerThread = Executors.newSingleThreadExecutor(); + writerThread = Executors.newSingleThreadExecutor( new ThreadFactory() { + @Override + public Thread newThread(Runnable r) { + Thread t = new Thread(r,"MotorWriterThread"); + return t; + } + }); - loaderPool = Executors.newFixedThreadPool(25); + loaderPool = Executors.newFixedThreadPool(25, new ThreadFactory() { + int threadCount = 0; + @Override + public Thread newThread(Runnable r) { + Thread t = new Thread(r,"MotorLoaderPool-" + threadCount++); + return t; + } + }); workGenerator = new WorkGenerator();