diff --git a/common/src/main/java/io/netty/util/internal/IntegerHolder.java b/common/src/main/java/io/netty/util/internal/IntegerHolder.java deleted file mode 100644 index e19335ccf0..0000000000 --- a/common/src/main/java/io/netty/util/internal/IntegerHolder.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2014 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - -package io.netty.util.internal; - -/** - * @deprecated For removal in netty 4.2 - */ -@Deprecated -public final class IntegerHolder { - public int value; -} diff --git a/common/src/main/java/io/netty/util/internal/InternalThreadLocalMap.java b/common/src/main/java/io/netty/util/internal/InternalThreadLocalMap.java index 0a6a6c5648..493cbb1221 100644 --- a/common/src/main/java/io/netty/util/internal/InternalThreadLocalMap.java +++ b/common/src/main/java/io/netty/util/internal/InternalThreadLocalMap.java @@ -144,9 +144,6 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap if (handlerSharableCache != null) { count ++; } - if (counterHashCode != null) { - count ++; - } if (random != null) { count ++; } @@ -196,7 +193,7 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap public Map charsetEncoderCache() { Map cache = charsetEncoderCache; if (cache == null) { - charsetEncoderCache = cache = new IdentityHashMap(); + charsetEncoderCache = cache = new IdentityHashMap<>(); } return cache; } @@ -204,7 +201,7 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap public Map charsetDecoderCache() { Map cache = charsetDecoderCache; if (cache == null) { - charsetDecoderCache = cache = new IdentityHashMap(); + charsetDecoderCache = cache = new IdentityHashMap<>(); } return cache; } @@ -217,7 +214,7 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap public ArrayList arrayList(int minCapacity) { ArrayList list = (ArrayList) arrayList; if (list == null) { - arrayList = new ArrayList(minCapacity); + arrayList = new ArrayList<>(minCapacity); return (ArrayList) arrayList; } list.clear(); @@ -244,7 +241,7 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap public Map, TypeParameterMatcher> typeParameterMatcherGetCache() { Map, TypeParameterMatcher> cache = typeParameterMatcherGetCache; if (cache == null) { - typeParameterMatcherGetCache = cache = new IdentityHashMap, TypeParameterMatcher>(); + typeParameterMatcherGetCache = cache = new IdentityHashMap<>(); } return cache; } @@ -252,26 +249,16 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap public Map, Map> typeParameterMatcherFindCache() { Map, Map> cache = typeParameterMatcherFindCache; if (cache == null) { - typeParameterMatcherFindCache = cache = new IdentityHashMap, Map>(); + typeParameterMatcherFindCache = cache = new IdentityHashMap<>(); } return cache; } - @Deprecated - public IntegerHolder counterHashCode() { - return counterHashCode; - } - - @Deprecated - public void setCounterHashCode(IntegerHolder counterHashCode) { - this.counterHashCode = counterHashCode; - } - public Map, Boolean> handlerSharableCache() { Map, Boolean> cache = handlerSharableCache; if (cache == null) { // Start with small capacity to keep memory overhead as low as possible. - handlerSharableCache = cache = new WeakHashMap, Boolean>(4); + handlerSharableCache = cache = new WeakHashMap<>(4); } return cache; } diff --git a/common/src/main/java/io/netty/util/internal/UnpaddedInternalThreadLocalMap.java b/common/src/main/java/io/netty/util/internal/UnpaddedInternalThreadLocalMap.java index 2d0bb6cd15..d41eb4e425 100644 --- a/common/src/main/java/io/netty/util/internal/UnpaddedInternalThreadLocalMap.java +++ b/common/src/main/java/io/netty/util/internal/UnpaddedInternalThreadLocalMap.java @@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicInteger; */ class UnpaddedInternalThreadLocalMap { - static final ThreadLocal slowThreadLocalMap = new ThreadLocal(); + static final ThreadLocal slowThreadLocalMap = new ThreadLocal<>(); static final AtomicInteger nextIndex = new AtomicInteger(); /** Used by {@link FastThreadLocal} */ @@ -42,7 +42,6 @@ class UnpaddedInternalThreadLocalMap { int futureListenerStackDepth; int localChannelReaderStackDepth; Map, Boolean> handlerSharableCache; - IntegerHolder counterHashCode; ThreadLocalRandom random; Map, TypeParameterMatcher> typeParameterMatcherGetCache; Map, Map> typeParameterMatcherFindCache;