Remove obsolete code in ConcurrentReferenceHashMapTests
This commit is contained in:
parent
12078e6ec5
commit
ed49f86dfb
|
@ -509,11 +509,6 @@ class ConcurrentReferenceHashMapTests {
|
|||
map.createReferenceManager().createReference(null, 1234, null);
|
||||
}
|
||||
|
||||
private interface ValueFactory<V> {
|
||||
|
||||
V newValue(int k);
|
||||
}
|
||||
|
||||
|
||||
private static class TestWeakConcurrentCache<K, V> extends ConcurrentReferenceHashMap<K, V> {
|
||||
|
||||
|
@ -521,16 +516,10 @@ class ConcurrentReferenceHashMapTests {
|
|||
|
||||
private final LinkedList<MockReference<K, V>> queue = new LinkedList<>();
|
||||
|
||||
private boolean disableTestHooks;
|
||||
|
||||
public TestWeakConcurrentCache() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void setDisableTestHooks(boolean disableTestHooks) {
|
||||
this.disableTestHooks = disableTestHooks;
|
||||
}
|
||||
|
||||
public TestWeakConcurrentCache(int initialCapacity, float loadFactor, int concurrencyLevel) {
|
||||
super(initialCapacity, loadFactor, concurrencyLevel);
|
||||
}
|
||||
|
@ -541,9 +530,6 @@ class ConcurrentReferenceHashMapTests {
|
|||
|
||||
@Override
|
||||
protected int getHash(@Nullable Object o) {
|
||||
if (this.disableTestHooks) {
|
||||
return super.getHash(o);
|
||||
}
|
||||
// For testing we want more control of the hash
|
||||
this.supplementalHash = super.getHash(o);
|
||||
return (o != null ? o.hashCode() : 0);
|
||||
|
@ -558,16 +544,10 @@ class ConcurrentReferenceHashMapTests {
|
|||
return new ReferenceManager() {
|
||||
@Override
|
||||
public Reference<K, V> createReference(Entry<K, V> entry, int hash, @Nullable Reference<K, V> next) {
|
||||
if (TestWeakConcurrentCache.this.disableTestHooks) {
|
||||
return super.createReference(entry, hash, next);
|
||||
}
|
||||
return new MockReference<>(entry, hash, next, TestWeakConcurrentCache.this.queue);
|
||||
}
|
||||
@Override
|
||||
public Reference<K, V> pollForPurge() {
|
||||
if (TestWeakConcurrentCache.this.disableTestHooks) {
|
||||
return super.pollForPurge();
|
||||
}
|
||||
return TestWeakConcurrentCache.this.queue.isEmpty() ? null : TestWeakConcurrentCache.this.queue.removeFirst();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue