Class CompletedOperationCache<K extends OperationKey,R extends Serializable>
java.lang.Object
org.apache.flink.runtime.rest.handler.async.CompletedOperationCache<K,R>
- All Implemented Interfaces:
AutoCloseable,org.apache.flink.util.AutoCloseableAsync
@ThreadSafe
public class CompletedOperationCache<K extends OperationKey,R extends Serializable>
extends Object
implements org.apache.flink.util.AutoCloseableAsync
Cache to manage ongoing operations.
The cache allows to register ongoing operations by calling #registerOngoingOperation(K, CompletableFuture), where the CompletableFuture contains the operation result. Completed
operations will be removed from the cache automatically after a fixed timeout.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsOperation(K operationKey) Returns whether this cache contains an operation under the given operation key.Returns an optional containing theOperationResultfor the specified key, or an empty optional if no operation is registered under the key.voidregisterOngoingOperation(K operationKey, CompletableFuture<R> operationResultFuture) Registers an ongoing operation with the cache.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.util.AutoCloseableAsync
close
-
Constructor Details
-
CompletedOperationCache
-
-
Method Details
-
registerOngoingOperation
Registers an ongoing operation with the cache.- Parameters:
operationResultFuture- A future containing the operation result.- Throws:
IllegalStateException- if the cache is already shutting down
-
containsOperation
Returns whether this cache contains an operation under the given operation key. -
get
Returns an optional containing theOperationResultfor the specified key, or an empty optional if no operation is registered under the key. -
closeAsync
- Specified by:
closeAsyncin interfaceorg.apache.flink.util.AutoCloseableAsync
-