Tweak the pool sizes and allow for longer time to load things. This improves reliability on slower platforms.

This commit is contained in:
Kevin Ruland 2012-08-23 02:30:11 +00:00
parent 9c6191529c
commit 413225b474
2 changed files with 6 additions and 6 deletions

View File

@ -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");

View File

@ -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<Runnable>(),
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();