public final class Queues
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
static int | 
CAPACITY_UNSURE  | 
static int | 
SMALL_BUFFER_SIZE
A small default of available slots in a given container, compromise between intensive pipelines, small
 subscribers numbers and memory use. 
 | 
static int | 
XS_BUFFER_SIZE
An allocation friendly default of available slots in a given container, e.g. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static int | 
capacity(java.util.Queue q)
Return the capacity of a given  
Queue in a best effort fashion. | 
static int | 
ceilingNextPowerOfTwo(int x)
Calculate the next power of 2, greater than or equal to x. 
 | 
static <T> java.util.function.Supplier<java.util.Queue<T>> | 
empty()
A  
Supplier for an empty immutable Queue, to be used as a placeholder
 in methods that require a Queue when one doesn't expect to store any data in said
 Queue. | 
static <T> java.util.function.Supplier<java.util.Queue<T>> | 
get(int batchSize)  | 
static boolean | 
isPowerOfTwo(int x)  | 
static <T> java.util.function.Supplier<java.util.Queue<T>> | 
one()  | 
static <T> java.util.function.Supplier<java.util.Queue<T>> | 
small()  | 
static <T> java.util.function.Supplier<java.util.Queue<T>> | 
unbounded()  | 
static <T> java.util.function.Supplier<java.util.Queue<T>> | 
unbounded(int linkSize)
Returns an unbounded, linked-array-based Queue. 
 | 
static <T> java.util.function.Supplier<java.util.Queue<T>> | 
unboundedMultiproducer()
Returns an unbounded queue suitable for multi-producer/single-consumer (MPSC)
 scenarios. 
 | 
static <T> java.util.function.Supplier<java.util.Queue<T>> | 
xs()  | 
public static final int CAPACITY_UNSURE
public static final int XS_BUFFER_SIZE
public static final int SMALL_BUFFER_SIZE
public static final int capacity(java.util.Queue q)
Queue in a best effort fashion. Queues that
 are known to be unbounded will return Integer.MAX_VALUE and queues that
 have a known bounded capacity will return that capacity. For other Queue
 implementations not recognized by this method or not providing this kind of
 information, CAPACITY_UNSURE (Integer.MIN_VALUE) is returned.q - the Queue to try to get a capacity forCAPACITY_UNSURE negative constant.public static int ceilingNextPowerOfTwo(int x)
From Hacker's Delight, Chapter 3, Harry S. Warren Jr.
x - Value to round uppublic static <T> java.util.function.Supplier<java.util.Queue<T>> get(int batchSize)
T - the reified Queue generic typebatchSize - the bounded or unbounded (int.max) queue sizeQueue Supplierpublic static boolean isPowerOfTwo(int x)
x - the int to testpublic static <T> java.util.function.Supplier<java.util.Queue<T>> empty()
Supplier for an empty immutable Queue, to be used as a placeholder
 in methods that require a Queue when one doesn't expect to store any data in said
 Queue.T - the reified Queue generic typeQueue Supplierpublic static <T> java.util.function.Supplier<java.util.Queue<T>> one()
T - the reified Queue generic typeQueue Supplierpublic static <T> java.util.function.Supplier<java.util.Queue<T>> small()
T - the reified Queue generic typeQueue Supplierpublic static <T> java.util.function.Supplier<java.util.Queue<T>> unbounded()
T - the reified Queue generic typeQueue Supplierpublic static <T> java.util.function.Supplier<java.util.Queue<T>> unbounded(int linkSize)
SMALL_BUFFER_SIZE size.T - the reified Queue generic typelinkSize - the link sizeQueue Supplierpublic static <T> java.util.function.Supplier<java.util.Queue<T>> xs()
T - the reified Queue generic typeQueue Supplierpublic static <T> java.util.function.Supplier<java.util.Queue<T>> unboundedMultiproducer()
T - the reified Queue generic typeQueue Supplier