Class DaemonThreadFactory

java.lang.Object
io.opentelemetry.sdk.internal.DaemonThreadFactory
All Implemented Interfaces:
ThreadFactory

public final class DaemonThreadFactory extends Object implements ThreadFactory
A ThreadFactory that delegates to Executors.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 Details

    • namePrefix

      private final String namePrefix
    • counter

      private final AtomicInteger counter
    • delegate

      private final ThreadFactory delegate
    • propagateContextForTesting

      private final boolean propagateContextForTesting
  • Constructor Details

    • DaemonThreadFactory

      public DaemonThreadFactory(String namePrefix)
    • DaemonThreadFactory

      public DaemonThreadFactory(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's Context will be passed over to the new threads, this is useful for validating scenarios where context propagation is available through bytecode instrumentation.
  • Method Details