org.apache.ignite.internal.util

## Class GridThreadLocal<T>

- java.lang.Object
- - java.lang.ThreadLocal<T>
  - - org.apache.ignite.internal.util.GridThreadLocal<T>

    public class GridThreadLocal<T>
    extends ThreadLocal<T>

Thread local that auto resets upon leaving thread context. This thread local is integrated with `GridKernalGateway` and with `GridWorker` threads.

### Constructor Summary

Constructors
Constructor and Description
`GridThreadLocal()`
`GridThreadLocal(IgniteOutClosure<T> initializer)`

### Method Summary

Methods
`static void` `enter()` Callback for start of thread context.
`T` `get()`
`protected T` `initialValue()`
`static void` `leave()` Callback for end of thread context.
`void` `set(T val)`

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

`remove`

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

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

### Constructor Detail

#### GridThreadLocal

    public GridThreadLocal()

#### GridThreadLocal

    public GridThreadLocal(IgniteOutClosure<T> initializer)

Parameters:
  `initializer` - Initializer.

### Method Detail

#### enter

    public static void enter()

Callback for start of thread context.

#### leave

    public static void leave()

Callback for end of thread context.

#### initialValue

    @Nullable
    protected T initialValue()

Overrides:
  `initialValue` in class `ThreadLocal<T>`

#### get

    public final T get()

Overrides:
  `get` in class `ThreadLocal<T>`

#### set

    public final void set(T val)

Overrides:
  `set` in class `ThreadLocal<T>`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC1
Release Date | : February 17 2015