Class RestrictionInterrupter<T>
- java.lang.Object
-
- org.apache.beam.sdk.io.gcp.spanner.changestreams.restriction.RestrictionInterrupter<T>
-
public class RestrictionInterrupter<T> extends java.lang.ObjectAn interrupter for restriction tracker of type T.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleantryInterrupt(@NonNull T position)Returns true if the restriction tracker should be interrupted in claiming new positions.static <T> RestrictionInterrupter<T>withSoftTimeout(org.joda.time.Duration timeout)Sets a soft timeout from now for processing new positions.
-
-
-
Method Detail
-
withSoftTimeout
public static <T> RestrictionInterrupter<T> withSoftTimeout(org.joda.time.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.- If soft deadline hasn't been reached always returns false.
- If soft deadline has been reached but we haven't processed any positions returns false.
- If soft deadline has been reached but the new position is the same as the last attempted position returns false.
- If soft deadline has been reached and the new position differs from the last attempted position returns true.
- Returns:
trueif the position processing should continue,falseif the soft deadline has been reached and we have fully processed the previous position.
-
-