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)
AllocationReservation
Adding may fail if the allocator is not allowed to consume any more space.
add
in interface AllocationReservation
nBytes
- the number of bytes to addpublic DrillBuf allocateBuffer()
AllocationReservation
The allocation request can still fail, even if the amount of space requested is available, if the allocation cannot be made contiguously.
allocateBuffer
in interface AllocationReservation
public int getSize()
AllocationReservation
getSize
in interface AllocationReservation
public boolean isUsed()
AllocationReservation
isUsed
in interface AllocationReservation
public boolean isClosed()
AllocationReservation
isClosed
in interface AllocationReservation
public void close()
close
in interface AutoCloseable
close
in interface AllocationReservation
public boolean reserve(int nBytes)
AllocationReservation
The implementation of the allocator's inner class provides this.
reserve
in interface AllocationReservation
nBytes
- the amount to reserveCopyright © 1970 The Apache Software Foundation. All rights reserved.