Class ContextStateFutureImpl<T>
- java.lang.Object
-
- org.apache.flink.core.state.StateFutureImpl<T>
-
- org.apache.flink.runtime.asyncprocessing.ContextStateFutureImpl<T>
-
- All Implemented Interfaces:
StateFuture<T>
,InternalStateFuture<T>
public class ContextStateFutureImpl<T> extends StateFutureImpl<T>
A state future that holds theRecordContext
and maintains the reference count of it. The reason why we maintain the reference here is that the ContextStateFutureImpl can be created multiple times since user may chain their code wildly, some of which are only for internal usage (SeeStateFutureImpl
). So maintaining reference counting by the lifecycle of state future is relatively simple and less error-prone.Reference counting added on
RecordContext
follows:- 1. +1 when this future created.
- 2. -1 when future completed.
- 3. +1 when callback registered.
- 4. -1 when callback finished.
- Please refer to
ContextStateFutureImplTest
where the reference counting is carefully tested.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.core.state.StateFutureImpl
StateFutureImpl.AsyncFrameworkExceptionHandler, StateFutureImpl.CallbackRunner
-
-
Field Summary
-
Fields inherited from class org.apache.flink.core.state.StateFutureImpl
callbackRunner, exceptionHandler
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
callbackFinished()
Will be triggered when a callback finishes processing.void
callbackRegistered()
Will be triggered when a callback is registered.<A> StateFutureImpl<A>
makeNewStateFuture()
Make a new future based on context of this future.void
postComplete(boolean inCallbackRunner)
Will be triggered when this future completes.-
Methods inherited from class org.apache.flink.core.state.StateFutureImpl
complete, completeExceptionally, get, isDone, thenAccept, thenApply, thenCombine, thenCompose, thenConditionallyAccept, thenConditionallyAccept, thenConditionallyApply, thenConditionallyApply, thenConditionallyCompose, thenConditionallyCompose, thenSyncAccept
-
-
-
-
Method Detail
-
makeNewStateFuture
public <A> StateFutureImpl<A> makeNewStateFuture()
Description copied from class:StateFutureImpl
Make a new future based on context of this future. Subclasses need to overload this method to generate their own instances (if needed).- Overrides:
makeNewStateFuture
in classStateFutureImpl<T>
- Returns:
- the new created future.
-
callbackRegistered
public void callbackRegistered()
Description copied from class:StateFutureImpl
Will be triggered when a callback is registered.- Overrides:
callbackRegistered
in classStateFutureImpl<T>
-
postComplete
public void postComplete(boolean inCallbackRunner)
Description copied from class:StateFutureImpl
Will be triggered when this future completes.- Overrides:
postComplete
in classStateFutureImpl<T>
-
callbackFinished
public void callbackFinished()
Description copied from class:StateFutureImpl
Will be triggered when a callback finishes processing.- Overrides:
callbackFinished
in classStateFutureImpl<T>
-
-