org.apache.cassandra.concurrent

## Class NamedThreadFactory

- java.lang.Object
- - org.apache.cassandra.concurrent.NamedThreadFactory

All Implemented Interfaces:
  java.util.concurrent.ThreadFactory

    public class NamedThreadFactory
    extends java.lang.Object
    implements java.util.concurrent.ThreadFactory

This class is an implementation of the ThreadFactory interface. This is useful to give Java threads meaningful names which is useful when using a tool like JConsole.

### Field Summary

Fields
`java.lang.String` `id`
`protected java.util.concurrent.atomic.AtomicInteger` `n`

### Constructor Summary

Constructors
Constructor and Description
`NamedThreadFactory(java.lang.String id)`
`NamedThreadFactory(java.lang.String id, int priority)`
`NamedThreadFactory(java.lang.String id, int priority, java.lang.ClassLoader contextClassLoader, java.lang.ThreadGroup threadGroup)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static java.lang.Thread` `createThread(java.lang.Runnable runnable)`
`static java.lang.Thread` `createThread(java.lang.Runnable runnable, java.lang.String name)`
`static java.lang.Thread` `createThread(java.lang.Runnable runnable, java.lang.String name, boolean daemon)`
`static java.lang.Thread` `createThread(java.lang.ThreadGroup threadGroup, java.lang.Runnable runnable, java.lang.String name)`
`static java.lang.Thread` `createThread(java.lang.ThreadGroup threadGroup, java.lang.Runnable runnable, java.lang.String name, boolean daemon)`
`java.lang.Thread` `newThread(java.lang.Runnable runnable)`
`static java.lang.Runnable` `threadLocalDeallocator(java.lang.Runnable r)` Ensures that `FastThreadLocal.remove()` is called when the `Runnable.run()` method of the given `Runnable` instance completes to ensure cleanup of `FastThreadLocal` instances.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### id

    public final java.lang.String id

#### n

    protected final java.util.concurrent.atomic.AtomicInteger n

### Constructor Detail

#### NamedThreadFactory

    public NamedThreadFactory(java.lang.String id)

#### NamedThreadFactory

    public NamedThreadFactory(java.lang.String id,
                              int priority)

#### NamedThreadFactory

    public NamedThreadFactory(java.lang.String id,
                              int priority,
                              java.lang.ClassLoader contextClassLoader,
                              java.lang.ThreadGroup threadGroup)

### Method Detail

#### newThread

    public java.lang.Thread newThread(java.lang.Runnable runnable)

Specified by:
  `newThread` in interface `java.util.concurrent.ThreadFactory`

#### threadLocalDeallocator

    public static java.lang.Runnable threadLocalDeallocator(java.lang.Runnable r)

Ensures that `FastThreadLocal.remove()` is called when the `Runnable.run()` method of the given `Runnable` instance completes to ensure cleanup of `FastThreadLocal` instances. This is especially important for direct byte buffers allocated locally for a thread.

#### createThread

    public static java.lang.Thread createThread(java.lang.Runnable runnable)

#### createThread

    public static java.lang.Thread createThread(java.lang.Runnable runnable,
                                                java.lang.String name)

#### createThread

    public static java.lang.Thread createThread(java.lang.Runnable runnable,
                                                java.lang.String name,
                                                boolean daemon)

#### createThread

    public static java.lang.Thread createThread(java.lang.ThreadGroup threadGroup,
                                                java.lang.Runnable runnable,
                                                java.lang.String name)

#### createThread

    public static java.lang.Thread createThread(java.lang.ThreadGroup threadGroup,
                                                java.lang.Runnable runnable,
                                                java.lang.String name,
                                                boolean daemon)