public abstract class RestrictionTracker<RestrictionT,PositionT>
extends java.lang.Object
DoFn
.Constructor and Description |
---|
RestrictionTracker() |
Modifier and Type | Method and Description |
---|---|
abstract void |
checkDone()
Called by the runner after
DoFn.ProcessElement returns. |
abstract RestrictionT |
checkpoint()
Signals that the current
DoFn.ProcessElement call should terminate as soon as possible:
after this method returns, the tracker MUST refuse all future claim calls, and checkDone() MUST succeed. |
abstract RestrictionT |
currentRestriction()
Returns a restriction accurately describing the full range of work the current
DoFn.ProcessElement call will do, including already completed work. |
abstract boolean |
tryClaim(PositionT position)
Attempts to claim the block of work in the current restriction identified by the given
position.
|
public abstract boolean tryClaim(PositionT position)
If this succeeds, the DoFn MUST execute the entire block of work. If this fails:
DoFn.ProcessElement
MUST return DoFn.ProcessContinuation#stop
without
performing any additional work or emitting output (note that emitting output or
performing work from DoFn.ProcessElement
is also not allowed before the first
call to this method).
checkDone()
MUST succeed.
public abstract RestrictionT currentRestriction()
DoFn.ProcessElement
call will do, including already completed work.public abstract RestrictionT checkpoint()
DoFn.ProcessElement
call should terminate as soon as possible:
after this method returns, the tracker MUST refuse all future claim calls, and checkDone()
MUST succeed.
Modifies currentRestriction()
. Returns a restriction representing the rest of the
work: the old value of currentRestriction()
is equivalent to the new value and the
return value of this method combined.
Must be called at most once on a given object. Must not be called before the first
successful tryClaim(PositionT)
call.
public abstract void checkDone() throws java.lang.IllegalStateException
DoFn.ProcessElement
returns.
Must throw an exception with an informative error message, if there is still any unclaimed work remaining in the restriction.
java.lang.IllegalStateException