FreeListManager { static void verifyOffHeapFreeListCount(int tinyFreeListCount) { if (tinyFreeListCount <= 0) { throw new IllegalStateException( GeodeGlossary.GEMFIRE_PREFIX + "OFF_HEAP_FREE_LIST_COUNT must be >= 1."); } } FreeListManager(MemoryAllocatorImpl ma, final Slab[] slabs); long getUsedMemory(); long getFreeMemory(); @SuppressWarnings("synthetic-access") OffHeapStoredObject allocate(int size); @SuppressWarnings("synthetic-access") void free(long addr); static final int TINY_MULTIPLE; static final int TINY_FREE_LIST_COUNT; static final int HUGE_MULTIPLE; static final int MAX_TINY; }
@Test public void offHeapFreeListCountLessThanZeroIsIllegal() { try { FreeListManager.verifyOffHeapFreeListCount(-1); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { assertThat(expected.getMessage()) .contains(GeodeGlossary.GEMFIRE_PREFIX + "OFF_HEAP_FREE_LIST_COUNT must be >= 1."); } }
@Test public void offHeapFreeListCountOfZeroIsIllegal() { try { FreeListManager.verifyOffHeapFreeListCount(0); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { assertThat(expected.getMessage()) .contains(GeodeGlossary.GEMFIRE_PREFIX + "OFF_HEAP_FREE_LIST_COUNT must be >= 1."); } }
@Test public void offHeapFreeListCountOfOneIsLegal() { FreeListManager.verifyOffHeapFreeListCount(1); }