Minor clean-ups in MockBigArrays (#21822)
Removes an unused static variable and an unused instance variable.
This commit is contained in:
parent
7e198f0e41
commit
8390648709
|
@ -48,7 +48,6 @@ public class MockBigArrays extends BigArrays {
|
||||||
*/
|
*/
|
||||||
private static final boolean TRACK_ALLOCATIONS = false;
|
private static final boolean TRACK_ALLOCATIONS = false;
|
||||||
|
|
||||||
private static final Set<BigArrays> INSTANCES = Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<BigArrays, Boolean>()));
|
|
||||||
private static final ConcurrentMap<Object, Object> ACQUIRED_ARRAYS = new ConcurrentHashMap<>();
|
private static final ConcurrentMap<Object, Object> ACQUIRED_ARRAYS = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static void ensureAllArraysAreReleased() throws Exception {
|
public static void ensureAllArraysAreReleased() throws Exception {
|
||||||
|
@ -88,7 +87,6 @@ public class MockBigArrays extends BigArrays {
|
||||||
seed = 0;
|
seed = 0;
|
||||||
}
|
}
|
||||||
random = new Random(seed);
|
random = new Random(seed);
|
||||||
INSTANCES.add(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,15 +245,13 @@ public class MockBigArrays extends BigArrays {
|
||||||
|
|
||||||
private abstract static class AbstractArrayWrapper {
|
private abstract static class AbstractArrayWrapper {
|
||||||
|
|
||||||
final BigArray in;
|
final boolean clearOnResize;
|
||||||
boolean clearOnResize;
|
private final AtomicReference<AssertionError> originalRelease;
|
||||||
AtomicReference<AssertionError> originalRelease;
|
|
||||||
|
|
||||||
AbstractArrayWrapper(BigArray in, boolean clearOnResize) {
|
AbstractArrayWrapper(boolean clearOnResize) {
|
||||||
ACQUIRED_ARRAYS.put(this, TRACK_ALLOCATIONS ? new RuntimeException() : Boolean.TRUE);
|
|
||||||
this.in = in;
|
|
||||||
this.clearOnResize = clearOnResize;
|
this.clearOnResize = clearOnResize;
|
||||||
originalRelease = new AtomicReference<>();
|
this.originalRelease = new AtomicReference<>();
|
||||||
|
ACQUIRED_ARRAYS.put(this, TRACK_ALLOCATIONS ? new RuntimeException() : Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract BigArray getDelegate();
|
protected abstract BigArray getDelegate();
|
||||||
|
@ -267,7 +263,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long ramBytesUsed() {
|
public long ramBytesUsed() {
|
||||||
return in.ramBytesUsed();
|
return getDelegate().ramBytesUsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
|
@ -286,7 +282,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
private final ByteArray in;
|
private final ByteArray in;
|
||||||
|
|
||||||
ByteArrayWrapper(ByteArray in, boolean clearOnResize) {
|
ByteArrayWrapper(ByteArray in, boolean clearOnResize) {
|
||||||
super(in, clearOnResize);
|
super(clearOnResize);
|
||||||
this.in = in;
|
this.in = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +332,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
private final IntArray in;
|
private final IntArray in;
|
||||||
|
|
||||||
IntArrayWrapper(IntArray in, boolean clearOnResize) {
|
IntArrayWrapper(IntArray in, boolean clearOnResize) {
|
||||||
super(in, clearOnResize);
|
super(clearOnResize);
|
||||||
this.in = in;
|
this.in = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +377,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
private final LongArray in;
|
private final LongArray in;
|
||||||
|
|
||||||
LongArrayWrapper(LongArray in, boolean clearOnResize) {
|
LongArrayWrapper(LongArray in, boolean clearOnResize) {
|
||||||
super(in, clearOnResize);
|
super(clearOnResize);
|
||||||
this.in = in;
|
this.in = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +423,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
private final FloatArray in;
|
private final FloatArray in;
|
||||||
|
|
||||||
FloatArrayWrapper(FloatArray in, boolean clearOnResize) {
|
FloatArrayWrapper(FloatArray in, boolean clearOnResize) {
|
||||||
super(in, clearOnResize);
|
super(clearOnResize);
|
||||||
this.in = in;
|
this.in = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,7 +468,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
private final DoubleArray in;
|
private final DoubleArray in;
|
||||||
|
|
||||||
DoubleArrayWrapper(DoubleArray in, boolean clearOnResize) {
|
DoubleArrayWrapper(DoubleArray in, boolean clearOnResize) {
|
||||||
super(in, clearOnResize);
|
super(clearOnResize);
|
||||||
this.in = in;
|
this.in = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,7 +513,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
private final ObjectArray<T> in;
|
private final ObjectArray<T> in;
|
||||||
|
|
||||||
ObjectArrayWrapper(ObjectArray<T> in) {
|
ObjectArrayWrapper(ObjectArray<T> in) {
|
||||||
super(in, false);
|
super(false);
|
||||||
this.in = in;
|
this.in = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue