public class BaseAllocator.Reservation extends Object implements AllocationReservation
| Constructor and Description |
|---|
Reservation() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int nBytes)
Add to the current reservation.
|
DrillBuf |
allocateBuffer()
Allocate a buffer whose size is the total of all the add()s made.
|
void |
close() |
int |
getSize()
Get the current size of the reservation (the sum of all the add()s).
|
boolean |
isClosed()
Return whether or not the reservation has been closed.
|
boolean |
isUsed()
Return whether or not the reservation has been used.
|
boolean |
reserve(int nBytes)
Requests a reservation of additional space.
|
public boolean add(int nBytes)
AllocationReservationAdding may fail if the allocator is not allowed to consume any more space.
add in interface AllocationReservationnBytes - the number of bytes to addpublic DrillBuf allocateBuffer()
AllocationReservationThe allocation request can still fail, even if the amount of space requested is available, if the allocation cannot be made contiguously.
allocateBuffer in interface AllocationReservationpublic int getSize()
AllocationReservationgetSize in interface AllocationReservationpublic boolean isUsed()
AllocationReservationisUsed in interface AllocationReservationpublic boolean isClosed()
AllocationReservationisClosed in interface AllocationReservationpublic void close()
close in interface AutoCloseableclose in interface AllocationReservationpublic boolean reserve(int nBytes)
AllocationReservationThe implementation of the allocator's inner class provides this.
reserve in interface AllocationReservationnBytes - the amount to reserveCopyright © 2021 The Apache Software Foundation. All rights reserved.