Use FastThreadLocal in more places

This commit is contained in:
Trustin Lee 2014-06-14 17:45:43 +09:00
parent c076c33901
commit 776ac4ba19
3 changed files with 6 additions and 3 deletions

View File

@ -16,6 +16,7 @@
package io.netty.handler.codec; package io.netty.handler.codec;
import io.netty.util.internal.FastThreadLocal;
import io.netty.util.internal.PlatformDependent; import io.netty.util.internal.PlatformDependent;
import java.text.DateFormat; import java.text.DateFormat;
@ -791,7 +792,7 @@ public class DefaultTextHeaders implements TextHeaders {
private static final ParsePosition parsePos = new ParsePosition(0); private static final ParsePosition parsePos = new ParsePosition(0);
private static final ThreadLocal<HttpHeaderDateFormat> dateFormatThreadLocal = private static final ThreadLocal<HttpHeaderDateFormat> dateFormatThreadLocal =
new ThreadLocal<HttpHeaderDateFormat>() { new FastThreadLocal<HttpHeaderDateFormat>() {
@Override @Override
protected HttpHeaderDateFormat initialValue() { protected HttpHeaderDateFormat initialValue() {
return new HttpHeaderDateFormat(); return new HttpHeaderDateFormat();

View File

@ -207,7 +207,7 @@ public class ThreadLocalRandom extends Random {
* The actual ThreadLocal * The actual ThreadLocal
*/ */
private static final ThreadLocal<ThreadLocalRandom> localRandom = private static final ThreadLocal<ThreadLocalRandom> localRandom =
new ThreadLocal<ThreadLocalRandom>() { new FastThreadLocal<ThreadLocalRandom>() {
protected ThreadLocalRandom initialValue() { protected ThreadLocalRandom initialValue() {
return new ThreadLocalRandom(); return new ThreadLocalRandom();
} }

View File

@ -22,6 +22,8 @@
package io.netty.util.internal.chmv8; package io.netty.util.internal.chmv8;
import io.netty.util.internal.FastThreadLocal;
import java.io.ObjectStreamField; import java.io.ObjectStreamField;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
@ -6032,7 +6034,7 @@ public class ConcurrentHashMapV8<K,V>
* Per-thread counter hash codes. Shared across all instances. * Per-thread counter hash codes. Shared across all instances.
*/ */
static final ThreadLocal<CounterHashCode> threadCounterHashCode = static final ThreadLocal<CounterHashCode> threadCounterHashCode =
new ThreadLocal<CounterHashCode>(); new FastThreadLocal<CounterHashCode>();
final long sumCount() { final long sumCount() {