public final class TrackerStatus extends Object implements EventTrackerStatus
EventTrackerStatus, providing simply modification methods to switch from one EventTrackerStatus value object to another.| Constructor and Description |
|---|
TrackerStatus(Segment segment,
boolean caughtUp,
TrackingToken trackingToken,
Throwable errorState)
|
TrackerStatus(Segment segment,
TrackingToken trackingToken)
|
| Modifier and Type | Method and Description |
|---|---|
TrackerStatus |
advancedTo(TrackingToken trackingToken)
|
TrackerStatus |
caughtUp()
Returns this
TrackerStatus if it is caught up, otherwise return a new instance with the caught up flag
set to true. |
boolean |
equals(Object o) |
OptionalLong |
getCurrentPosition()
Return the estimated relative current token position this Segment represents.
|
Throwable |
getError()
Returns the exception that caused processing to fail, if present.
|
TrackingToken |
getInternalTrackingToken()
Return the
TrackingToken this EventTrackerStatus portrays the status of. |
OptionalLong |
getResetPosition()
Return the relative position at which a reset was triggered for this Segment.
|
Segment |
getSegment()
The segment for which this status is valid.
|
TrackingToken |
getTrackingToken()
The tracking token of the last event that has been seen by this Segment.
|
int |
hashCode() |
boolean |
isCaughtUp()
Whether the Segment of this status has caught up with the head of the event stream.
|
boolean |
isErrorState()
Indicates whether this status represents an error.
|
boolean |
isMerging()
Indicates whether this Segment is still merging two (or more) Segments.
|
boolean |
isReplaying()
Indicates whether this Segment is still replaying previously processed Events.
|
TrackerStatus |
markError(Throwable error)
|
OptionalLong |
mergeCompletedPosition()
Return the estimated relative token position this Segment will have after a merge operation is complete.
|
TrackerStatus[] |
split()
Splits the current status object to reflect the status of their underlying segments being split.
|
static TrackerStatus[] |
split(Segment segment,
TrackingToken trackingToken)
Split the given
segment and trackingToken in two. |
String |
toString() |
TrackerStatus |
unmarkError()
Return a new
TrackerStatus based on this status, removing the errorState. |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitisDifferent, isDifferent, matchPositions, matchStates, trackerAdded, trackerRemovedpublic TrackerStatus(Segment segment, TrackingToken trackingToken)
segment - the Segment this EventTrackerStatus shares the status oftrackingToken - the TrackingToken this EventTrackerStatus shares the status ofpublic TrackerStatus(Segment segment, boolean caughtUp, TrackingToken trackingToken, Throwable errorState)
EventTrackerStatus to portray the status of the given segment and trackingToken. The caughtUp boolean specifies whether the trackingToken reached the head of the
stream at least once. A Throwable can be provided to signal this EventTrackerStatus is in an
error statesegment - the Segment this EventTrackerStatus shares the status ofcaughtUp - a boolean specifying whether this EventTrackerStatus reached the head of the
stream at least once.trackingToken - the TrackingToken this EventTrackerStatus shares the status oferrorState - a Throwable defining the error status of this EventTrackerStatus. If null, the status is not in an error statepublic TrackerStatus caughtUp()
TrackerStatus if it is caught up, otherwise return a new instance with the caught up flag
set to true.TrackerStatus if it is caught up, otherwise return a new instance with the caught up flag
set to truepublic TrackerStatus advancedTo(TrackingToken trackingToken)
TrackerStatus' TrackingToken towards the given trackingToken. If this
status' token is identical to the given token, return this. Otherwise create a new TrackerStatus
instance using the given trackingToken.trackingToken - the TrackingToken to advance this TrackerStatus' token towards, if they are
not the sameTrackerStatus if the given trackingToken is identical to the current one, otherwise
a new TrackerStatus instance with the given trackingTokenpublic TrackerStatus markError(Throwable error)
error - the Throwable used to define the errorStateTrackerStatus based on this status, setting the given error as the errorStatepublic TrackerStatus unmarkError()
TrackerStatus based on this status, removing the errorState.TrackerStatus based on this status, removing the errorStatepublic TrackingToken getInternalTrackingToken()
TrackingToken this EventTrackerStatus portrays the status of.TrackingToken this EventTrackerStatus portrays the status ofpublic TrackerStatus[] split()
public static TrackerStatus[] split(Segment segment, TrackingToken trackingToken)
segment and trackingToken in two. Constructs an array containing two TrackerStatuss objects based on the split.segment - the Segment to split in twotrackingToken - the TrackingToken to split in twoTrackerStatuss objects based on the split of the given segment and trackingTokenpublic Segment getSegment()
EventTrackerStatusgetSegment in interface EventTrackerStatuspublic boolean isCaughtUp()
EventTrackerStatusisCaughtUp in interface EventTrackerStatuspublic boolean isReplaying()
EventTrackerStatus
Note that this method will only recognize a replay if the tokens have been reset using TrackingEventProcessor.resetTokens(). Removing tokens directly from the underlying TokenStore will not
be recognized as a replay.
isReplaying in interface EventTrackerStatustrue if this segment is replaying historic events after a reset, otherwise falsepublic boolean isMerging()
EventTrackerStatusisMerging in interface EventTrackerStatustrue if this segment is merging Segments, otherwise falsepublic OptionalLong mergeCompletedPosition()
EventTrackerStatusEventTrackerStatus.isMerging() } returns true. In case no estimation
can be given or no merge in progress, an OptionalLong.empty() will be returned.mergeCompletedPosition in interface EventTrackerStatuspublic TrackingToken getTrackingToken()
EventTrackerStatusThe returned tracking token represents the position of this segment in the event stream. In case of a recent merge of segments, the token represents the lowest position of the two merged segments.
getTrackingToken in interface EventTrackerStatuspublic boolean isErrorState()
EventTrackerStatustrue, the EventTrackerStatus.getError()
will return the exception that caused the failure.isErrorState in interface EventTrackerStatustrue if an error was reported, otherwise falsepublic Throwable getError()
EventTrackerStatusnull.getError in interface EventTrackerStatusnull when processing normallypublic OptionalLong getCurrentPosition()
EventTrackerStatusOptionalLong.empty() will be returned.getCurrentPosition in interface EventTrackerStatuspublic OptionalLong getResetPosition()
EventTrackerStatusOptionalLong.empty() will be returned.getResetPosition in interface EventTrackerStatusCopyright © 2010–2023. All rights reserved.