From: kruland2607 Date: Wed, 9 May 2012 02:00:54 +0000 (+0000) Subject: Give the threads names to facilitate thread performance analysis. X-Git-Tag: upstream/12.09^2~291 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=cab6b8fb951447148aeb3b21953cdb5d068d033a;p=debian%2Fopenrocket 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 --- 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();