Package org.apache.datasketches.memory
Interface MemoryRequestServer
-
- All Known Implementing Classes:
DefaultMemoryRequestServer
public interface MemoryRequestServer
The MemoryRequestServer is a callback interface to provide a means for off-heap, heap and ByteBuffer backed resources to request more memory.- Author:
- Lee Rhodes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description WritableMemory
request(WritableMemory currentWritableMemory, long newCapacityBytes)
Request new WritableMemory with the given newCapacityBytes.default void
requestClose(WritableMemory memToClose)
Request to close the resource, if applicable.void
requestClose(WritableMemory memToClose, WritableMemory newMemory)
Request to close the resource, if applicable.
-
-
-
Method Detail
-
request
WritableMemory request(WritableMemory currentWritableMemory, long newCapacityBytes)
Request new WritableMemory with the given newCapacityBytes. The current Writable Memory will be used to determine the byte order of the returned WritableMemory and other properties.- Parameters:
currentWritableMemory
- the current writableMemory of the client. It must be non-null.newCapacityBytes
- The capacity being requested. It must be > the capacity of the currentWritableMemory.- Returns:
- new WritableMemory with the requested capacity.
-
requestClose
default void requestClose(WritableMemory memToClose)
Request to close the resource, if applicable.- Parameters:
memToClose
- the relevant WritableMemory to be considered for closing. It must be non-null.
-
requestClose
void requestClose(WritableMemory memToClose, WritableMemory newMemory)
Request to close the resource, if applicable.- Parameters:
memToClose
- the relevant WritbleMemory to be considered for closing. It must be non-null.newMemory
- the newly allocated WritableMemory. The newMemory reference is returned from the client for the convenience of the system that owns the responsibility of memory allocation. It may be null.
-
-