From 89ff888c27d25dfeb98ce05c5934afb871194fae Mon Sep 17 00:00:00 2001 From: Kevin Ruland Date: Wed, 6 Jun 2012 12:07:18 +0000 Subject: [PATCH] Explicitly create the writerThread to be an executor with an unbounded linked blocking queue. I have sometimes seen rejected exceptions (which should never happen) using the Executors.newSingleThreadExecutor which makes me doubt the documentation. --- .../ConcurrentLoadingThrustCurveMotorSetDatabase.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java b/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java index 0a12605b6..a546f739e 100644 --- a/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java +++ b/core/src/net/sf/openrocket/startup/ConcurrentLoadingThrustCurveMotorSetDatabase.java @@ -5,7 +5,6 @@ import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; @@ -124,7 +123,9 @@ public class ConcurrentLoadingThrustCurveMotorSetDatabase extends ThrustCurveMot private BookKeeping() { - writerThread = Executors.newSingleThreadExecutor( new ThreadFactory() { + writerThread = new ThreadPoolExecutor(1,1,200, TimeUnit.SECONDS, + new LinkedBlockingQueue(), + new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = new Thread(r,"MotorWriterThread");