java.util.concurrent.ConcurrentLinkedQueue
which is an unbounded multi-producer, multi-consumer queue which
is further encumbered by the need to implement the full range of java.util.Queue
methods. In this package we
offer a range of implementations:
Limited Queue methods support:
The queues implement a subset of the java.
interface which is documented under the
io.
interface. In particular java.
is usually not
supported and dependent methods from java.
are also not supported such as:
java.util.Queue#remove(Object)
java.util.Queue#removeAll(java.util.Collection)
java.util.Queue#removeIf(java.util.function.Predicate)
java.util.Queue#contains(Object)
java.util.Queue#containsAll(java.util.Collection)
Memory layout controls and False Sharing:
The classes in this package use what is considered at the moment the most reliable method of controlling class field
layout, namely inheritance. The method is described in this
post which also covers
why other methods are currently suspect.
Note that we attempt to tackle both active (write/write) and passive(read/write) false sharing case:
Use of sun.misc.Unsafe:
A choice is made in this library to utilize sun.misc.Unsafe for performance reasons. In this package we have two use
cases:
java.util.concurrent.atomic.AtomicLongFieldUpdater
but
choose not to for performance reasons. On newer OpenJDKs where AFU is made more performant the difference is small.
java.util.concurrent.atomic.AtomicReferenceArray
but choose not to for performance reasons(extra reference
chase and redundant boundary checks).
Avoiding redundant loads of fields:
Because a volatile load will force any following field access to reload the field value an effort is made to cache
field values in local variables where possible and expose interfaces which allow the code to capitalize on such
caching. As a convention the local variable name will be the field name and will be final.
Method naming conventions:
The following convention is followed in method naming to highlight volatile/ordered/plain access to fields:
java.util.concurrent.atomic.AtomicInteger#lazySet(int)
). Implies an ordering of stores (StoreStore barrier
before the store).
java.util.concurrent.atomic.AtomicInteger#compareAndSet(int, int)
java.util.concurrent.atomic.AtomicInteger#getAndSet(int)
java.util.concurrent.atomic.AtomicInteger#getAndAdd(int)
Modifier and Type | Interface and Description |
---|---|
public interface | MessagePassingQueue<
the event/message type T>Message passing queues are intended for concurrent method passing. |
public interface | QueueProgressIndicators
This interface is provided for monitoring purposes only and is only available on queues where it is easy to provide it. |
public interface | SupportsIterator
Tagging interface to help testing |
Modifier and Type | Class and Description |
---|---|
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | BaseMpscLinkedArrayQueue<E>
An MPSC array queue which starts at initialCapacity and grows to maxCapacity in linked chunks of the initial size. |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
public class | IndexedQueueSizeUtil
A note to maintainers on index assumptions: in a single threaded world it would seem intuitive to assume:
|
pack-priv class | LinkedArrayQueueUtil
This is used for method substitution in the LinkedArray classes code generation. |
pack-priv class | |
public class | |
public class | MpmcArrayQueue<E>
A Multi-Producer-Multi-Consumer queue based on a |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
public class | |
pack-priv class | |
public class | MpscArrayQueue<E>
A Multi-Producer-Single-Consumer queue based on a |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
public class | MpscBlockingConsumerArrayQueue<E>
This is a partial implementation of the |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
public class | MpscChunkedArrayQueue<E>
An MPSC array queue which starts at initialCapacity and grows to maxCapacity in linked chunks of the initial size. |
pack-priv abstract class | |
public class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | MpscCompoundQueueL0Pad<E>
Use a set number of parallel MPSC queues to diffuse the contention on tail. |
pack-priv abstract class | |
public class | MpscGrowableArrayQueue<E>
An MPSC array queue which starts at initialCapacity and grows to maxCapacity in linked chunks, doubling theirs size every time until the full blown backing array is used. |
public class | |
public class | MpscUnboundedArrayQueue<E>
An MPSC array queue which starts at initialCapacity and grows indefinitely in linked chunks of the initial size. |
public class | |
pack-priv class | |
pack-priv abstract class | MpUnboundedXaddArrayQueue<R extends MpUnboundedXaddChunk
Common infrastructure for the XADD queues. |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv class | |
public class | QueueFactory
Deprecated
The queue factory produces java. instances based on a best fit to the ConcurrentQueueSpec .
|
public class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
public class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
pack-priv abstract class | |
public class | SpscChunkedArrayQueue<E>
An SPSC array queue which starts at initialCapacity and grows to maxCapacity in linked chunks of the initial size. |
public class | SpscGrowableArrayQueue<E>
An SPSC array queue which starts at initialCapacity and grows to maxCapacity in linked chunks, doubling theirs size every time until the full blown backing array is used. |
public class | |
public class | SpscUnboundedArrayQueue<E>
An SPSC array queue which starts at initialCapacity and grows indefinitely in linked chunks of the initial size. |