T
- the queue element typepublic final class QueueSupplier<T>
extends java.lang.Object
implements java.util.function.Supplier<java.util.Queue<T>>
Modifier and Type | Field and Description |
---|---|
static int |
MEDIUM_BUFFER_SIZE
A larger default of available slots in a given container, e.g.
|
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 |
ceilingNextPowerOfTwo(int x)
Calculate the next power of 2, greater than or equal to x.
|
java.util.Queue<T> |
get() |
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>> |
xs() |
public static final int MEDIUM_BUFFER_SIZE
public static final int XS_BUFFER_SIZE
public static final int SMALL_BUFFER_SIZE
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
Supplier
public static boolean isPowerOfTwo(int x)
x
- the int to testpublic static <T> java.util.function.Supplier<java.util.Queue<T>> one()
T
- the reified Queue
generic typeQueue
Supplier
public static <T> java.util.function.Supplier<java.util.Queue<T>> small()
T
- the reified Queue
generic typeQueue
Supplier
public static <T> java.util.function.Supplier<java.util.Queue<T>> unbounded()
T
- the reified Queue
generic typeQueue
Supplier
public static <T> java.util.function.Supplier<java.util.Queue<T>> unbounded(int linkSize)
T
- the reified Queue
generic typelinkSize
- the link sizeQueue
Supplier
public static <T> java.util.function.Supplier<java.util.Queue<T>> xs()
T
- the reified Queue
generic typeQueue
Supplier