]> git.gag.com Git - debian/openrocket/commitdiff
Give the threads names to facilitate thread performance analysis.
authorkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Wed, 9 May 2012 02:00:54 +0000 (02:00 +0000)
committerkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Wed, 9 May 2012 02:00:54 +0000 (02:00 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@656 180e2498-e6e9-4542-8430-84ac67f01cd8

core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java

index a5f6006b990c8da5b0f89f7c33cc58e20a68fa58..3f6e9fcbb9190b74a182487eb4685df4304f3cd2 100644 (file)
@@ -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();