public final class Queues extends 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(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> Supplier<Queue<T>> | 
empty()
 | 
static <T> Supplier<Queue<T>> | 
get(int batchSize)  | 
static boolean | 
isPowerOfTwo(int x)  | 
static <T> Supplier<Queue<T>> | 
one()  | 
static <T> Supplier<Queue<T>> | 
small()  | 
static <T> Supplier<Queue<T>> | 
unbounded()  | 
static <T> Supplier<Queue<T>> | 
unbounded(int linkSize)
Returns an unbounded, linked-array-based Queue. 
 | 
static <T> Supplier<Queue<T>> | 
unboundedMultiproducer()
Returns an unbounded queue suitable for multi-producer/single-consumer (MPSC)
 scenarios. 
 | 
static <T> Supplier<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(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 boolean isPowerOfTwo(int x)
x - the int to testpublic static <T> Supplier<Queue<T>> unbounded(int linkSize)
SMALL_BUFFER_SIZE size.