View Javadoc
1   /*
2   * Copyright 2014 The Netty Project
3   *
4   * The Netty Project licenses this file to you under the Apache License,
5   * version 2.0 (the "License"); you may not use this file except in compliance
6   * with the License. You may obtain a copy of the License at:
7   *
8   *   http://www.apache.org/licenses/LICENSE-2.0
9   *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations
14  * under the License.
15  */
16  package io.netty.util.concurrent;
17  
18  import io.netty.util.internal.InternalThreadLocalMap;
19  
20  /**
21   * A special {@link Thread} that provides fast access to {@link FastThreadLocal} variables.
22   */
23  public class FastThreadLocalThread extends Thread implements FastThreadLocalAccess {
24  
25      private InternalThreadLocalMap threadLocalMap;
26  
27      public FastThreadLocalThread() { }
28  
29      public FastThreadLocalThread(Runnable target) {
30          super(target);
31      }
32  
33      public FastThreadLocalThread(ThreadGroup group, Runnable target) {
34          super(group, target);
35      }
36  
37      public FastThreadLocalThread(String name) {
38          super(name);
39      }
40  
41      public FastThreadLocalThread(ThreadGroup group, String name) {
42          super(group, name);
43      }
44  
45      public FastThreadLocalThread(Runnable target, String name) {
46          super(target, name);
47      }
48  
49      public FastThreadLocalThread(ThreadGroup group, Runnable target, String name) {
50          super(group, target, name);
51      }
52  
53      public FastThreadLocalThread(ThreadGroup group, Runnable target, String name, long stackSize) {
54          super(group, target, name, stackSize);
55      }
56  
57      /**
58       * Returns the internal data structure that keeps the thread-local variables bound to this thread.
59       * Note that this method is for internal use only, and thus is subject to change at any time.
60       */
61      @Override
62      public final InternalThreadLocalMap threadLocalMap() {
63          return threadLocalMap;
64      }
65  
66      /**
67       * Sets the internal data structure that keeps the thread-local variables bound to this thread.
68       * Note that this method is for internal use only, and thus is subject to change at any time.
69       */
70      @Override
71      public final void setThreadLocalMap(InternalThreadLocalMap threadLocalMap) {
72          this.threadLocalMap = threadLocalMap;
73      }
74  }