Class JcTools
- java.lang.Object
-
- io.opentelemetry.sdk.trace.internal.JcTools
-
public final class JcTools extends java.lang.Object
Internal accessor of JCTools package for fast queues.This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Logger
logger
private static java.util.concurrent.atomic.AtomicBoolean
queueCreationWarningLogged
-
Constructor Summary
Constructors Modifier Constructor Description private
JcTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
capacity(java.util.Queue<?> queue)
Returns the capacity of theQueue
.static <T> void
drain(java.util.Queue<T> queue, int limit, java.util.function.Consumer<T> consumer)
Remove up to limit elements from theQueue
and hand to consume.private static <T> void
drainNonJcQueue(java.util.Queue<T> queue, int maxExportBatchSize, java.util.function.Consumer<T> consumer)
static <T> java.util.Queue<T>
newFixedSizeQueue(int capacity)
Returns a newQueue
appropriate for use with multiple producers and a single consumer.
-
-
-
Method Detail
-
newFixedSizeQueue
public static <T> java.util.Queue<T> newFixedSizeQueue(int capacity)
Returns a newQueue
appropriate for use with multiple producers and a single consumer.
-
capacity
public static long capacity(java.util.Queue<?> queue)
Returns the capacity of theQueue
. We cast to the implementation so callers do not need to use the shaded classes.
-
drain
public static <T> void drain(java.util.Queue<T> queue, int limit, java.util.function.Consumer<T> consumer)
Remove up to limit elements from theQueue
and hand to consume.- Throws:
java.lang.IllegalArgumentException
- consumer isnull
java.lang.IllegalArgumentException
- if maxExportBatchSize is negative
-
drainNonJcQueue
private static <T> void drainNonJcQueue(java.util.Queue<T> queue, int maxExportBatchSize, java.util.function.Consumer<T> consumer)
-
-