public final class SharedResources extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
SharedResources.ResourceAndSize<T extends AutoCloseable>
A resource handle with size.
|
| 构造器和说明 |
|---|
SharedResources() |
| 限定符和类型 | 方法和说明 |
|---|---|
<T extends AutoCloseable> |
getOrAllocateSharedResource(String type,
Object leaseHolder,
org.apache.flink.util.function.LongFunctionWithException<T,Exception> initializer,
long sizeForInitialization)
Gets the shared memory resource for the given owner and registers a lease.
|
void |
release(String type,
Object leaseHolder,
java.util.function.LongConsumer releaser)
Releases a lease (identified by the lease holder object) for the given type.
|
public <T extends AutoCloseable> SharedResources.ResourceAndSize<T> getOrAllocateSharedResource(String type, Object leaseHolder, org.apache.flink.util.function.LongFunctionWithException<T,Exception> initializer, long sizeForInitialization) throws Exception
The resource must be released when no longer used. That releases the lease. When all leases are released, the resource is disposed.
Exceptionpublic void release(String type, Object leaseHolder, java.util.function.LongConsumer releaser) throws Exception
This method takes an additional hook that is called when the resource is disposed.
ExceptionCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.