Class ContextStateFutureImpl<T>

java.lang.Object
org.apache.flink.core.state.StateFutureImpl<T>
org.apache.flink.runtime.asyncprocessing.ContextStateFutureImpl<T>
All Implemented Interfaces:
org.apache.flink.api.common.state.v2.StateFuture<T>, org.apache.flink.core.state.InternalStateFuture<T>

public class ContextStateFutureImpl<T> extends org.apache.flink.core.state.StateFutureImpl<T>
A state future that holds the RecordContext 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 (See StateFutureImpl). 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

      org.apache.flink.core.state.StateFutureImpl.AsyncFrameworkExceptionHandler, org.apache.flink.core.state.StateFutureImpl.CallbackRunner
    • Field Summary

      Fields inherited from class org.apache.flink.core.state.StateFutureImpl

      callbackRunner, exceptionHandler
    • Method Summary

      Modifier and Type
      Method
      Description
      void
       
      void
       
      <A> org.apache.flink.core.state.StateFutureImpl<A>
       
      void
      postComplete(boolean inCallbackRunner)
       

      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

      Methods inherited from class java.lang.Object

      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Details

      • makeNewStateFuture

        public <A> org.apache.flink.core.state.StateFutureImpl<A> makeNewStateFuture()
        Overrides:
        makeNewStateFuture in class org.apache.flink.core.state.StateFutureImpl<T>
      • callbackRegistered

        public void callbackRegistered()
        Overrides:
        callbackRegistered in class org.apache.flink.core.state.StateFutureImpl<T>
      • postComplete

        public void postComplete(boolean inCallbackRunner)
        Overrides:
        postComplete in class org.apache.flink.core.state.StateFutureImpl<T>
      • callbackFinished

        public void callbackFinished()
        Overrides:
        callbackFinished in class org.apache.flink.core.state.StateFutureImpl<T>