I'd like to use a CircularFifoQueue
with spring ExecutorService
.
The following does not compile, because CircularFifoQueue
is not of type BlockingQueue
. But it shows what I'm trying to achieve:
int threads = 10;
int queueSize = 500;
new java.util.concurrent.ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS,
new CircularFifoQueue(queueSize));
With:
package org.apache.commons.collections4.queue;
public class CircularFifoQueue<E> extends AbstractCollection<E>
implements Queue<E>, BoundedCollection<E>, Serializable
Question: does the code above provide thread safety (as CircularFifoQueue
itself is not threadsafe)?
If not, how can I make it threadsafe?