Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class AllocationManager {
private final UnsafeDirectLittleEndian underlying;
// ARROW-1627 Trying to minimize memory overhead caused by previously used IdentityHashMap
// see JIRA for details
private final LowCostIdentityHasMap<BaseAllocator, BufferLedger> map = new LowCostIdentityHasMap<>();
private final LowCostIdentityHashMap<BaseAllocator, BufferLedger> map = new LowCostIdentityHashMap<>();
private final ReadWriteLock lock = new ReentrantReadWriteLock();
private final AutoCloseableLock readLock = new AutoCloseableLock(lock.readLock());
private final AutoCloseableLock writeLock = new AutoCloseableLock(lock.writeLock());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* that provides "getKey" method
* @param <V>
*/
public class LowCostIdentityHasMap<K, V extends ValueWithKeyIncluded<K>> {
public class LowCostIdentityHashMap<K, V extends ValueWithKeyIncluded<K>> {

/*
* The internal data structure to hold values.
Expand All @@ -52,7 +52,7 @@ public class LowCostIdentityHasMap<K, V extends ValueWithKeyIncluded<K>> {
/**
* Creates an Map with default expected maximum size.
*/
public LowCostIdentityHasMap() {
public LowCostIdentityHashMap() {
this(DEFAULT_MIN_SIZE);
}

Expand All @@ -63,7 +63,7 @@ public LowCostIdentityHasMap() {
* The estimated maximum number of entries that will be put in
* this map.
*/
public LowCostIdentityHasMap(int maxSize) {
public LowCostIdentityHashMap(int maxSize) {
if (maxSize >= 0) {
this.size = 0;
threshold = getThreshold(maxSize);
Expand Down Expand Up @@ -96,7 +96,7 @@ private int computeElementArraySize() {
private Object[] newElementArray(int s) {
return new Object[s];
}

/**
* Removes all elements from this map, leaving it empty.
*
Expand Down Expand Up @@ -331,4 +331,4 @@ public V getNextValue() {
}
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
/**
* To test simplified implementation of IdentityHashMap
*/
public class TestLowCostIdentityHasMap {
public class TestLowCostIdentityHashMap {

@Test
public void testIdentityHashMap() throws Exception {
LowCostIdentityHasMap<String, StringWithKey> hashMap = new LowCostIdentityHasMap<>();
LowCostIdentityHashMap<String, StringWithKey> hashMap = new LowCostIdentityHashMap<>();

StringWithKey obj1 = new StringWithKey("s1key", "s1value");
StringWithKey obj2 = new StringWithKey("s2key", "s2value");
Expand Down Expand Up @@ -88,7 +88,7 @@ public void testIdentityHashMap() throws Exception {

@Test
public void testLargeMap() throws Exception {
LowCostIdentityHasMap<String, StringWithKey> hashMap = new LowCostIdentityHasMap<>();
LowCostIdentityHashMap<String, StringWithKey> hashMap = new LowCostIdentityHashMap<>();

String [] keys = new String[200];
for (int i = 0; i < 200; i++) {
Expand Down