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.

This commit is contained in:
Kevin Ruland 2012-06-06 12:07:18 +00:00
parent 17fa9ae55d
commit 89ff888c27

View File

@ -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<Runnable>(),
new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r,"MotorWriterThread");