Class RestrictionInterrupter<T>

java.lang.Object
org.apache.beam.sdk.io.gcp.spanner.changestreams.restriction.RestrictionInterrupter<T>

public class RestrictionInterrupter<T> extends Object
An interrupter for restriction tracker of type T.
  • Method Details

    • withSoftTimeout

      public static <T> RestrictionInterrupter<T> withSoftTimeout(Duration timeout)
      Sets a soft timeout from now for processing new positions. After the timeout the tryInterrupt will start returning true indicating an early exit from processing.
    • tryInterrupt

      public boolean tryInterrupt(@NonNull T position)
      Returns true if the restriction tracker should be interrupted in claiming new positions.
      1. If soft deadline hasn't been reached always returns false.
      2. If soft deadline has been reached but we haven't processed any positions returns false.
      3. If soft deadline has been reached but the new position is the same as the last attempted position returns false.
      4. If soft deadline has been reached and the new position differs from the last attempted position returns true.
      Returns:
      true if the position processing should continue, false if the soft deadline has been reached and we have fully processed the previous position.