Class ContextAsyncFutureImpl<T>

  • All Implemented Interfaces:
    org.apache.flink.api.common.state.v2.StateFuture<T>, org.apache.flink.core.asyncprocessing.AsyncFuture<T>, org.apache.flink.core.asyncprocessing.InternalAsyncFuture<T>

    public class ContextAsyncFutureImpl<T>
    extends org.apache.flink.core.asyncprocessing.AsyncFutureImpl<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 ContextAsyncFutureImpl can be created multiple times since user may chain their code wildly, some of which are only for internal usage (See AsyncFutureImpl). 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.