From cab6b8fb951447148aeb3b21953cdb5d068d033a Mon Sep 17 00:00:00 2001 From: kruland2607 Date: Wed, 9 May 2012 02:00:54 +0000 Subject: [PATCH] Give the threads names to facilitate thread performance analysis. git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@656 180e2498-e6e9-4542-8430-84ac67f01cd8 --- ...entLoadingThrustCurveMotorSetDatabase.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java b/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java index a5f6006b..3f6e9fcb 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(); - - loaderPool = Executors.newFixedThreadPool(25); + writerThread = Executors.newSingleThreadExecutor( new ThreadFactory() { + @Override + public Thread newThread(Runnable r) { + Thread t = new Thread(r,"MotorWriterThread"); + return t; + } + }); + + 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(); -- 2.47.2