Not used IntegerHolder class removed (#8747)

Motivation:

IntergerHolder was left from some old days and not used anymore.

Modification:

Remove IntergerHolder from the codebase.

Result:

Removed unused code
This commit is contained in:
Dmitriy Dumanskiy 2019-01-22 12:25:08 +02:00 committed by Norman Maurer
parent 45c0ea543f
commit 91e7e3d8c9
3 changed files with 7 additions and 46 deletions

View File

@ -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;
}

View File

@ -144,9 +144,6 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap
if (handlerSharableCache != null) { if (handlerSharableCache != null) {
count ++; count ++;
} }
if (counterHashCode != null) {
count ++;
}
if (random != null) { if (random != null) {
count ++; count ++;
} }
@ -196,7 +193,7 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap
public Map<Charset, CharsetEncoder> charsetEncoderCache() { public Map<Charset, CharsetEncoder> charsetEncoderCache() {
Map<Charset, CharsetEncoder> cache = charsetEncoderCache; Map<Charset, CharsetEncoder> cache = charsetEncoderCache;
if (cache == null) { if (cache == null) {
charsetEncoderCache = cache = new IdentityHashMap<Charset, CharsetEncoder>(); charsetEncoderCache = cache = new IdentityHashMap<>();
} }
return cache; return cache;
} }
@ -204,7 +201,7 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap
public Map<Charset, CharsetDecoder> charsetDecoderCache() { public Map<Charset, CharsetDecoder> charsetDecoderCache() {
Map<Charset, CharsetDecoder> cache = charsetDecoderCache; Map<Charset, CharsetDecoder> cache = charsetDecoderCache;
if (cache == null) { if (cache == null) {
charsetDecoderCache = cache = new IdentityHashMap<Charset, CharsetDecoder>(); charsetDecoderCache = cache = new IdentityHashMap<>();
} }
return cache; return cache;
} }
@ -217,7 +214,7 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap
public <E> ArrayList<E> arrayList(int minCapacity) { public <E> ArrayList<E> arrayList(int minCapacity) {
ArrayList<E> list = (ArrayList<E>) arrayList; ArrayList<E> list = (ArrayList<E>) arrayList;
if (list == null) { if (list == null) {
arrayList = new ArrayList<Object>(minCapacity); arrayList = new ArrayList<>(minCapacity);
return (ArrayList<E>) arrayList; return (ArrayList<E>) arrayList;
} }
list.clear(); list.clear();
@ -244,7 +241,7 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap
public Map<Class<?>, TypeParameterMatcher> typeParameterMatcherGetCache() { public Map<Class<?>, TypeParameterMatcher> typeParameterMatcherGetCache() {
Map<Class<?>, TypeParameterMatcher> cache = typeParameterMatcherGetCache; Map<Class<?>, TypeParameterMatcher> cache = typeParameterMatcherGetCache;
if (cache == null) { if (cache == null) {
typeParameterMatcherGetCache = cache = new IdentityHashMap<Class<?>, TypeParameterMatcher>(); typeParameterMatcherGetCache = cache = new IdentityHashMap<>();
} }
return cache; return cache;
} }
@ -252,26 +249,16 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap
public Map<Class<?>, Map<String, TypeParameterMatcher>> typeParameterMatcherFindCache() { public Map<Class<?>, Map<String, TypeParameterMatcher>> typeParameterMatcherFindCache() {
Map<Class<?>, Map<String, TypeParameterMatcher>> cache = typeParameterMatcherFindCache; Map<Class<?>, Map<String, TypeParameterMatcher>> cache = typeParameterMatcherFindCache;
if (cache == null) { if (cache == null) {
typeParameterMatcherFindCache = cache = new IdentityHashMap<Class<?>, Map<String, TypeParameterMatcher>>(); typeParameterMatcherFindCache = cache = new IdentityHashMap<>();
} }
return cache; return cache;
} }
@Deprecated
public IntegerHolder counterHashCode() {
return counterHashCode;
}
@Deprecated
public void setCounterHashCode(IntegerHolder counterHashCode) {
this.counterHashCode = counterHashCode;
}
public Map<Class<?>, Boolean> handlerSharableCache() { public Map<Class<?>, Boolean> handlerSharableCache() {
Map<Class<?>, Boolean> cache = handlerSharableCache; Map<Class<?>, Boolean> cache = handlerSharableCache;
if (cache == null) { if (cache == null) {
// Start with small capacity to keep memory overhead as low as possible. // Start with small capacity to keep memory overhead as low as possible.
handlerSharableCache = cache = new WeakHashMap<Class<?>, Boolean>(4); handlerSharableCache = cache = new WeakHashMap<>(4);
} }
return cache; return cache;
} }

View File

@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicInteger;
*/ */
class UnpaddedInternalThreadLocalMap { class UnpaddedInternalThreadLocalMap {
static final ThreadLocal<InternalThreadLocalMap> slowThreadLocalMap = new ThreadLocal<InternalThreadLocalMap>(); static final ThreadLocal<InternalThreadLocalMap> slowThreadLocalMap = new ThreadLocal<>();
static final AtomicInteger nextIndex = new AtomicInteger(); static final AtomicInteger nextIndex = new AtomicInteger();
/** Used by {@link FastThreadLocal} */ /** Used by {@link FastThreadLocal} */
@ -42,7 +42,6 @@ class UnpaddedInternalThreadLocalMap {
int futureListenerStackDepth; int futureListenerStackDepth;
int localChannelReaderStackDepth; int localChannelReaderStackDepth;
Map<Class<?>, Boolean> handlerSharableCache; Map<Class<?>, Boolean> handlerSharableCache;
IntegerHolder counterHashCode;
ThreadLocalRandom random; ThreadLocalRandom random;
Map<Class<?>, TypeParameterMatcher> typeParameterMatcherGetCache; Map<Class<?>, TypeParameterMatcher> typeParameterMatcherGetCache;
Map<Class<?>, Map<String, TypeParameterMatcher>> typeParameterMatcherFindCache; Map<Class<?>, Map<String, TypeParameterMatcher>> typeParameterMatcherFindCache;