Tweak the pool sizes and allow for longer time to load things. This improves reliability on slower platforms.
This commit is contained in:
parent
9c6191529c
commit
413225b474
@ -49,7 +49,7 @@ public class ConcurrentComponentPresetDatabaseLoader {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
loaderPool = Executors.newFixedThreadPool(15, new ThreadFactory() {
|
loaderPool = Executors.newFixedThreadPool(3, new ThreadFactory() {
|
||||||
int threadCount = 0;
|
int threadCount = 0;
|
||||||
@Override
|
@Override
|
||||||
public Thread newThread(Runnable r) {
|
public Thread newThread(Runnable r) {
|
||||||
@ -70,9 +70,9 @@ public class ConcurrentComponentPresetDatabaseLoader {
|
|||||||
public void await() throws InterruptedException {
|
public void await() throws InterruptedException {
|
||||||
latch.await();
|
latch.await();
|
||||||
loaderPool.shutdown();
|
loaderPool.shutdown();
|
||||||
loaderPool.awaitTermination(30, TimeUnit.SECONDS);
|
loaderPool.awaitTermination(90, TimeUnit.SECONDS);
|
||||||
writerPool.shutdown();
|
writerPool.shutdown();
|
||||||
writerPool.awaitTermination(30, TimeUnit.SECONDS);
|
writerPool.awaitTermination(90, TimeUnit.SECONDS);
|
||||||
iterator.close();
|
iterator.close();
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
log.debug("Time to load presets: " + (end-startTime) + "ms " + presetCount + " loaded from " + fileCount + " files");
|
log.debug("Time to load presets: " + (end-startTime) + "ms " + presetCount + " loaded from " + fileCount + " files");
|
||||||
|
@ -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 LinkedBlockingQueue<Runnable>(),
|
||||||
new ThreadFactory() {
|
new ThreadFactory() {
|
||||||
int threadCount = 0;
|
int threadCount = 0;
|
||||||
@ -178,9 +178,9 @@ public class ConcurrentLoadingThrustCurveMotorSetDatabase extends ThrustCurveMot
|
|||||||
private void waitForFinish() throws InterruptedException {
|
private void waitForFinish() throws InterruptedException {
|
||||||
try {
|
try {
|
||||||
loaderPool.shutdown();
|
loaderPool.shutdown();
|
||||||
loaderPool.awaitTermination(30, TimeUnit.SECONDS);
|
loaderPool.awaitTermination(90, TimeUnit.SECONDS);
|
||||||
writerThread.shutdown();
|
writerThread.shutdown();
|
||||||
writerThread.awaitTermination(30, TimeUnit.SECONDS);
|
writerThread.awaitTermination(90, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
iterator.close();
|
iterator.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user