public class LowLevelCacheMemoryManager extends Object implements MemoryManager
Modifier and Type | Class and Description |
---|---|
static class |
LowLevelCacheMemoryManager.ReserveFailedException |
Constructor and Description |
---|
LowLevelCacheMemoryManager(long maxSize,
LowLevelCachePolicy evictor,
LlapDaemonCacheMetrics metrics) |
Modifier and Type | Method and Description |
---|---|
long |
evictMemory(long memoryToEvict)
Request the memory manager to evict more memory, this will be blocking and might return 0 if nothing was evicted.
|
long |
getCurrentUsedSize() |
void |
notifyProactiveEvictionMark() |
long |
purge() |
void |
releaseMemory(long memoryToRelease)
Signals to the Memory manager the release of some memory bytes that are free to be used.
|
void |
reserveMemory(long memoryToReserve,
AtomicBoolean isStopped)
Reserves some amount of bytes within the managed pool of memory.
|
boolean |
reserveMemory(long memoryToReserve,
boolean waitForEviction,
AtomicBoolean isStopped) |
void |
updateMaxSize(long maxSize)
Sets the amount of bytes that the memory manager is managing.
|
public LowLevelCacheMemoryManager(long maxSize, LowLevelCachePolicy evictor, LlapDaemonCacheMetrics metrics)
public void reserveMemory(long memoryToReserve, AtomicBoolean isStopped)
MemoryManager
Callers expect that the memory manager will always fulfill the request by notifying the Evictor about how much need to be evicted to accommodate the reserve request. Note that this method will block until reservation is fulfilled.
reserveMemory
in interface MemoryManager
memoryToReserve
- Amount of bytes to reserve.isStopped
- Caller state to indicate if it is still running while the memory manager is trying to
allocate the space.public long evictMemory(long memoryToEvict)
MemoryManager
evictMemory
in interface MemoryManager
memoryToEvict
- amount of bytes to evict.public boolean reserveMemory(long memoryToReserve, boolean waitForEviction, AtomicBoolean isStopped)
public void releaseMemory(long memoryToRelease)
MemoryManager
releaseMemory
in interface MemoryManager
memoryToRelease
- amount of memory bytes that are released to be added to the ledger as free.public void updateMaxSize(long maxSize)
MemoryManager
updateMaxSize
in interface MemoryManager
maxSize
- total amount of available bytes to be allocated.public long purge()
public void notifyProactiveEvictionMark()
public long getCurrentUsedSize()
Copyright © 2022 The Apache Software Foundation. All rights reserved.