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 direct (off-heap), heap and ByteBuffer backed resources to request more memory.- Author:
- Lee Rhodes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description WritableMemory
request(WritableMemory currentWritableMemory, long capacityBytes)
Request new WritableMemory with the given capacity.void
requestClose(WritableMemory memToClose, WritableMemory newMemory)
Request close the AutoCloseable resource.
-
-
-
Method Detail
-
request
WritableMemory request(WritableMemory currentWritableMemory, long capacityBytes)
Request new WritableMemory with the given capacity. The current Writable Memory will be used to determine the byte order of the returned WritableMemory and other checks.- Parameters:
currentWritableMemory
- the current writableMemory of the client. It must be non-null.capacityBytes
- The capacity being requested. It must be ≥ 0.- Returns:
- new WritableMemory with the given capacity.
-
requestClose
void requestClose(WritableMemory memToClose, WritableMemory newMemory)
Request close the AutoCloseable resource. This only applies to resources allocated using WritableMemory.allocateDirect(...). This may be ignored depending on the application implementation.- Parameters:
memToClose
- the relevant WritbleMemory to be considered for closing. It must be non-null.newMemory
- the newly allocated WritableMemory. It must be non-null. This is returned from the client to facilitate tracking for the convenience of the resource owner.
-
-