@FindbugsSuppressWarnings("ICAST_INTEGER_MULTIPLY_CAST_TO_LONG") protected OffHeapHashMap(PageSource source, boolean tableAllocationsSteal, StorageEngine<? super K, ? super V> storageEngine, int tableSize, boolean bootstrap) { if (storageEngine == null) { throw new NullPointerException("StorageEngine implementation must be non-null"); } this.storageEngine = storageEngine; this.tableSource = source; this.tableAllocationsSteal = tableAllocationsSteal; // Find a power of 2 >= initialCapacity int capacity = 1; while (capacity < tableSize) { capacity <<= 1; } this.initialTableSize = capacity; if (bootstrap) { this.hashTablePage = allocateTable(initialTableSize); if (hashTablePage == null) { String msg = "Initial table allocation failed.\n" + "Initial Table Size (slots) : " + initialTableSize + '\n' + "Allocation Will Require : " + DebuggingUtils.toBase2SuffixedString(initialTableSize * ENTRY_SIZE * (Integer.SIZE / Byte.SIZE)) + "B\n" + "Table Page Source : " + tableSource; throw new IllegalArgumentException(msg); } hashtable = hashTablePage.asIntBuffer(); } this.storageEngine.bind(this); }
@FindbugsSuppressWarnings("ICAST_INTEGER_MULTIPLY_CAST_TO_LONG") protected OffHeapHashMap(PageSource source, boolean tableAllocationsSteal, StorageEngine<? super K, ? super V> storageEngine, int tableSize, boolean bootstrap) { if (storageEngine == null) { throw new NullPointerException("StorageEngine implementation must be non-null"); } this.storageEngine = storageEngine; this.tableSource = source; this.tableAllocationsSteal = tableAllocationsSteal; // Find a power of 2 >= initialCapacity int capacity = 1; while (capacity < tableSize) { capacity <<= 1; } this.initialTableSize = capacity; if (bootstrap) { this.hashTablePage = allocateTable(initialTableSize); if (hashTablePage == null) { String msg = "Initial table allocation failed.\n" + "Initial Table Size (slots) : " + initialTableSize + '\n' + "Allocation Will Require : " + DebuggingUtils.toBase2SuffixedString(initialTableSize * ENTRY_SIZE * (Integer.SIZE / Byte.SIZE)) + "B\n" + "Table Page Source : " + tableSource; throw new IllegalArgumentException(msg); } hashtable = hashTablePage.asIntBuffer(); } this.storageEngine.bind(this); }