Package io.trino.memory
Class MemoryPool
- java.lang.Object
-
- io.trino.memory.MemoryPool
-
public class MemoryPool extends Object
-
-
Constructor Summary
Constructors Constructor Description MemoryPool(MemoryPoolId id, io.airlift.units.DataSize size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(MemoryPoolListener listener)voidfree(QueryId queryId, String allocationTag, long bytes)voidfreeRevocable(QueryId queryId, long bytes)longgetFreeBytes()Returns the number of free bytes.MemoryPoolIdgetId()MemoryPoolInfogetInfo()longgetMaxBytes()longgetReservedBytes()longgetReservedRevocableBytes()voidremoveListener(MemoryPoolListener listener)com.google.common.util.concurrent.ListenableFuture<?>reserve(QueryId queryId, String allocationTag, long bytes)Reserves the given number of bytes.com.google.common.util.concurrent.ListenableFuture<?>reserveRevocable(QueryId queryId, long bytes)StringtoString()booleantryReserve(QueryId queryId, String allocationTag, long bytes)Try to reserve the given number of bytes.
-
-
-
Constructor Detail
-
MemoryPool
public MemoryPool(MemoryPoolId id, io.airlift.units.DataSize size)
-
-
Method Detail
-
getId
public MemoryPoolId getId()
-
getInfo
public MemoryPoolInfo getInfo()
-
addListener
public void addListener(MemoryPoolListener listener)
-
removeListener
public void removeListener(MemoryPoolListener listener)
-
reserve
public com.google.common.util.concurrent.ListenableFuture<?> reserve(QueryId queryId, String allocationTag, long bytes)
Reserves the given number of bytes. Caller should wait on the returned future, before allocating more memory.
-
reserveRevocable
public com.google.common.util.concurrent.ListenableFuture<?> reserveRevocable(QueryId queryId, long bytes)
-
tryReserve
public boolean tryReserve(QueryId queryId, String allocationTag, long bytes)
Try to reserve the given number of bytes. Return value indicates whether the caller may use the requested memory.
-
freeRevocable
public void freeRevocable(QueryId queryId, long bytes)
-
getFreeBytes
public long getFreeBytes()
Returns the number of free bytes. This value may be negative, which indicates that the pool is over-committed.
-
getMaxBytes
public long getMaxBytes()
-
getReservedBytes
public long getReservedBytes()
-
getReservedRevocableBytes
public long getReservedRevocableBytes()
-
-