Class RestrictionInterrupter<T>
java.lang.Object
org.apache.beam.sdk.io.gcp.spanner.changestreams.restriction.RestrictionInterrupter<T>
An interrupter for restriction tracker of type T.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
tryInterrupt
(@NonNull T position) Returns true if the restriction tracker should be interrupted in claiming new positions.static <T> RestrictionInterrupter
<T> withSoftTimeout
(Duration timeout) Sets a soft timeout from now for processing new positions.
-
Method Details
-
withSoftTimeout
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
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:
true
if the position processing should continue,false
if the soft deadline has been reached and we have fully processed the previous position.
-