Package org.apache.flink.runtime.memory
Class OpaqueMemoryResource<T>
- java.lang.Object
-
- org.apache.flink.runtime.memory.OpaqueMemoryResource<T>
-
- All Implemented Interfaces:
AutoCloseable
public final class OpaqueMemoryResource<T> extends Object implements AutoCloseable
An opaque memory resource, meaning a memory resource not understood by Flink or the JVM. An example for this is a native resource, like RocksDB's block cache memory pool.The resource must be closed after it is not used any more.
-
-
Constructor Summary
Constructors Constructor Description OpaqueMemoryResource(T resourceHandle, long size, org.apache.flink.util.function.ThrowingRunnable<Exception> disposer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Releases this resource.T
getResourceHandle()
Gets the handle to the resource.long
getSize()
Gets the size, in bytes.String
toString()
-
-
-
Method Detail
-
getResourceHandle
public T getResourceHandle()
Gets the handle to the resource.
-
getSize
public long getSize()
Gets the size, in bytes.
-
close
public void close() throws Exception
Releases this resource. This method is idempotent.- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
-