From: kruland2607 Date: Thu, 23 Aug 2012 02:30:11 +0000 (+0000) Subject: Tweak the pool sizes and allow for longer time to load things. This improves reliabi... X-Git-Tag: upstream/12.09^2~36 X-Git-Url: https://git.gag.com/?p=debian%2Fopenrocket;a=commitdiff_plain;h=e21b77118f72c9c82ef379b3d044f042371f6d04 Tweak the pool sizes and allow for longer time to load things. This improves reliability on slower platforms. git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@988 180e2498-e6e9-4542-8430-84ac67f01cd8 --- diff --git a/core/src/net/sf/openrocket/startup/ConcurrentComponentPresetDatabaseLoader.java b/core/src/net/sf/openrocket/startup/ConcurrentComponentPresetDatabaseLoader.java index cc16ddc7..2e57fa5c 100644 --- a/core/src/net/sf/openrocket/startup/ConcurrentComponentPresetDatabaseLoader.java +++ b/core/src/net/sf/openrocket/startup/ConcurrentComponentPresetDatabaseLoader.java @@ -49,7 +49,7 @@ public class ConcurrentComponentPresetDatabaseLoader { } }); - loaderPool = Executors.newFixedThreadPool(15, new ThreadFactory() { + loaderPool = Executors.newFixedThreadPool(3, new ThreadFactory() { int threadCount = 0; @Override public Thread newThread(Runnable r) { @@ -70,9 +70,9 @@ public class ConcurrentComponentPresetDatabaseLoader { public void await() throws InterruptedException { latch.await(); loaderPool.shutdown(); - loaderPool.awaitTermination(30, TimeUnit.SECONDS); + loaderPool.awaitTermination(90, TimeUnit.SECONDS); writerPool.shutdown(); - writerPool.awaitTermination(30, TimeUnit.SECONDS); + writerPool.awaitTermination(90, TimeUnit.SECONDS); iterator.close(); long end = System.currentTimeMillis(); log.debug("Time to load presets: " + (end-startTime) + "ms " + presetCount + " loaded from " + fileCount + " files"); diff --git a/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java b/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java index c52d72e1..2eba9b42 100644 --- a/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java +++ b/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java @@ -149,7 +149,7 @@ public class ConcurrentLoadingThrustCurveMotorSetDatabase extends ThrustCurveMot } }); - loaderPool = new ThreadPoolExecutor(25,25, 2, TimeUnit.SECONDS, + loaderPool = new ThreadPoolExecutor(10,10, 2, TimeUnit.SECONDS, new LinkedBlockingQueue(), new ThreadFactory() { int threadCount = 0; @@ -178,9 +178,9 @@ public class ConcurrentLoadingThrustCurveMotorSetDatabase extends ThrustCurveMot private void waitForFinish() throws InterruptedException { try { loaderPool.shutdown(); - loaderPool.awaitTermination(30, TimeUnit.SECONDS); + loaderPool.awaitTermination(90, TimeUnit.SECONDS); writerThread.shutdown(); - writerThread.awaitTermination(30, TimeUnit.SECONDS); + writerThread.awaitTermination(90, TimeUnit.SECONDS); } finally { iterator.close();