Class MemoryPool
- java.lang.Object
-
- org.apache.iotdb.db.mpp.execution.memory.MemoryPool
-
public class MemoryPool extends java.lang.ObjectA thread-safe memory pool.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMemoryPool.MemoryReservationFuture<V>
-
Constructor Summary
Constructors Constructor Description MemoryPool(java.lang.String id, long maxBytes, long maxBytesPerQuery)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfree(java.lang.String queryId, long bytes)java.lang.StringgetId()longgetMaxBytes()longgetQueryMemoryReservedBytes(java.lang.String queryId)longgetReservedBytes()org.apache.iotdb.tsfile.utils.Pair<com.google.common.util.concurrent.ListenableFuture<java.lang.Void>,java.lang.Boolean>reserve(java.lang.String queryId, long bytes)longtryCancel(com.google.common.util.concurrent.ListenableFuture<java.lang.Void> future)Cancel the specified memory reservation.longtryComplete(com.google.common.util.concurrent.ListenableFuture<java.lang.Void> future)Complete the specified memory reservation.booleantryReserve(java.lang.String queryId, long bytes)
-
-
-
Method Detail
-
getId
public java.lang.String getId()
-
getMaxBytes
public long getMaxBytes()
-
reserve
public org.apache.iotdb.tsfile.utils.Pair<com.google.common.util.concurrent.ListenableFuture<java.lang.Void>,java.lang.Boolean> reserve(java.lang.String queryId, long bytes)- Returns:
- if reserve succeed, pair.right will be true, otherwise false
-
tryReserve
public boolean tryReserve(java.lang.String queryId, long bytes)
-
tryCancel
public long tryCancel(com.google.common.util.concurrent.ListenableFuture<java.lang.Void> future)
Cancel the specified memory reservation. If the reservation has finished, do nothing.- Parameters:
future- The future returned fromreserve(String, long)- Returns:
- If the future has not complete, return the number of bytes being reserved. Otherwise, return 0.
-
tryComplete
public long tryComplete(com.google.common.util.concurrent.ListenableFuture<java.lang.Void> future)
Complete the specified memory reservation. If the reservation has finished, do nothing.- Parameters:
future- The future returned fromreserve(String, long)- Returns:
- If the future has not complete, return the number of bytes being reserved. Otherwise, return 0.
-
free
public void free(java.lang.String queryId, long bytes)
-
getQueryMemoryReservedBytes
public long getQueryMemoryReservedBytes(java.lang.String queryId)
-
getReservedBytes
public long getReservedBytes()
-
-