public class MultiSourceTrackingToken extends Object implements TrackingToken, Serializable
TrackingToken
implementation combining several TrackingTokens
into one. Used to keep track of
several message sources at once, like the MultiStreamableMessageSource
.Constructor and Description |
---|
MultiSourceTrackingToken(Map<String,TrackingToken> trackingTokens)
Construct a new
MultiSourceTrackingToken from a map of existing tokens. |
Modifier and Type | Method and Description |
---|---|
MultiSourceTrackingToken |
advancedTo(String streamName,
TrackingToken newTokenForStream)
Advances a single token within the tokenMap
|
boolean |
covers(TrackingToken other)
Compares this token to
other checking each member token with its counterpart to see if they are covered
in the other token. |
boolean |
equals(Object o) |
TrackingToken |
getTokenForStream(String streamName)
Return the tracking token for an individual stream
|
Map<String,TrackingToken> |
getTrackingTokens()
Returns the map containing the constituent tokens.
|
int |
hashCode() |
TrackingToken |
lowerBound(TrackingToken other)
Compares this token to
other by comparing each member token with its counterpart in the other
token. |
OptionalLong |
position()
Returns the sum of all positions of the constituent tracking tokens.
|
String |
toString() |
TrackingToken |
upperBound(TrackingToken other)
Compares this token to
other by comparing each member token with its counterpart in the other
token. |
@ConstructorProperties(value="trackingTokens") public MultiSourceTrackingToken(Map<String,TrackingToken> trackingTokens)
MultiSourceTrackingToken
from a map of existing tokens.trackingTokens
- the map of tokens which make up the MultiSourceTrackingToken
public TrackingToken lowerBound(TrackingToken other)
other
by comparing each member token with its counterpart in the other
token. If the two tokens contain different number of constituent tokens, or have the same number but
different names, then these two MultiSourceTrackingToken
s must be tracking different
MultiStreamableMessageSource
s.lowerBound
in interface TrackingToken
other
- The token to compare to this onepublic TrackingToken upperBound(TrackingToken other)
other
by comparing each member token with its counterpart in the other
token. If the two tokens contain different number of constituent tokens, or have the same number but
different names, then these two MultiSourceTrackingToken
s must be tracking different
MultiStreamableMessageSource
s.upperBound
in interface TrackingToken
other
- The token to compare this token topublic boolean covers(TrackingToken other)
other
checking each member token with its counterpart to see if they are covered
in the other
token. If the two tokens contain different number of constituent tokens, or have the same number but
different names, then these two MultiSourceTrackingToken
s must be tracking different
MultiStreamableMessageSource
s.covers
in interface TrackingToken
other
- The token to compare to this onetrue
if this token covers the other, otherwise false
public MultiSourceTrackingToken advancedTo(String streamName, TrackingToken newTokenForStream)
streamName
- the stream/source which is being advancednewTokenForStream
- the token representing the new position of the streampublic TrackingToken getTokenForStream(String streamName)
streamName
- the name of the stream for the tracking tokenpublic Map<String,TrackingToken> getTrackingTokens()
public OptionalLong position()
position
in interface TrackingToken
Copyright © 2010–2023. All rights reserved.