Package io.opentelemetry.sdk.internal
Class DaemonThreadFactory
- java.lang.Object
-
- io.opentelemetry.sdk.internal.DaemonThreadFactory
-
- All Implemented Interfaces:
java.util.concurrent.ThreadFactory
public final class DaemonThreadFactory extends java.lang.Object implements java.util.concurrent.ThreadFactory
AThreadFactory
that delegates toExecutors.defaultThreadFactory()
and marks all threads as daemon.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 java.util.concurrent.atomic.AtomicInteger
counter
private java.util.concurrent.ThreadFactory
delegate
private java.lang.String
namePrefix
private boolean
propagateContextForTesting
-
Constructor Summary
Constructors Constructor Description DaemonThreadFactory(java.lang.String namePrefix)
DaemonThreadFactory(java.lang.String namePrefix, boolean propagateContextForTesting)
DaemonThreadFactory
's constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Thread
newThread(java.lang.Runnable runnable)
-
-
-
Constructor Detail
-
DaemonThreadFactory
public DaemonThreadFactory(java.lang.String namePrefix)
-
DaemonThreadFactory
public DaemonThreadFactory(java.lang.String namePrefix, boolean propagateContextForTesting)
DaemonThreadFactory
's constructor.- Parameters:
namePrefix
- Used when setting the new thread's name.propagateContextForTesting
- For tests only. When enabled, the current thread'sContext
will be passed over to the new threads, this is useful for validating scenarios where context propagation is available through bytecode instrumentation.
-
-