Class JcTools
- java.lang.Object
-
- io.opentelemetry.sdk.trace.internal.JcTools
-
public final class JcTools extends java.lang.ObjectInternal 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.Loggerloggerprivate static java.util.concurrent.atomic.AtomicBooleanqueueCreationWarningLogged
-
Constructor Summary
Constructors Modifier Constructor Description privateJcTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longcapacity(java.util.Queue<?> queue)Returns the capacity of theQueue.static <T> voiddrain(java.util.Queue<T> queue, int limit, java.util.function.Consumer<T> consumer)Remove up to limit elements from theQueueand hand to consume.private static <T> voiddrainNonJcQueue(java.util.Queue<T> queue, int maxExportBatchSize, java.util.function.Consumer<T> consumer)static <T> java.util.Queue<T>newFixedSizeQueue(int capacity)Returns a newQueueappropriate for use with multiple producers and a single consumer.
-
-
-
Method Detail
-
newFixedSizeQueue
public static <T> java.util.Queue<T> newFixedSizeQueue(int capacity)
Returns a newQueueappropriate 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 theQueueand hand to consume.- Throws:
java.lang.IllegalArgumentException- consumer isnulljava.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)
-
-