Class AbstractConsistencyMarker<T extends ConsistencyMarker>

java.lang.Object
org.axonframework.eventsourcing.eventstore.AbstractConsistencyMarker<T>
Type Parameters:
T - The type of ConsistencyMarker this implementation expects. It's typically the same as the implementing class.
All Implemented Interfaces:
ConsistencyMarker
Direct Known Subclasses:
AggregateBasedConsistencyMarker, GlobalIndexConsistencyMarker

public abstract class AbstractConsistencyMarker<T extends ConsistencyMarker> extends Object implements ConsistencyMarker
Abstract implementation of the ConsistencyMarker interface that implements the required comparisons with the ConsistencyMarker.ORIGIN and ConsistencyMarker.INFINITY consistency markers. The implementation-specific comparisons are left to the subclasses.
Since:
5.0.0
Author:
Allard Buijze
  • Constructor Details

    • AbstractConsistencyMarker

      public AbstractConsistencyMarker()
  • Method Details

    • lowerBound

      public ConsistencyMarker lowerBound(@Nonnull ConsistencyMarker other)
      Description copied from interface: ConsistencyMarker
      Returns a ConsistencyMarker that represents the lower bound of this and given other markers. Effectively, this means that any events whose position in the event stream is beyond either this or the other marker, will also be beyond the returned marker.
      Specified by:
      lowerBound in interface ConsistencyMarker
      Parameters:
      other - The other marker to create the lower bound for
      Returns:
      a ConsistencyMarker that represents the lower bound of two other markers
      Throws:
      ClassCastException - when the given marker is not of the expected type.
    • upperBound

      public ConsistencyMarker upperBound(@Nonnull ConsistencyMarker other)
      Description copied from interface: ConsistencyMarker
      Returns a ConsistencyMarker that represents the upper bound of this and given other markers. Effectively, this means that only events whose position in the event stream is beyond both this and the other marker, will also be beyond the returned marker.
      Specified by:
      upperBound in interface ConsistencyMarker
      Parameters:
      other - The other marker to create the upper bound for
      Returns:
      a ConsistencyMarker that represents the upper bound of two other markers
      Throws:
      ClassCastException - when the given marker is not of the expected type
    • doLowerBound

      protected abstract ConsistencyMarker doLowerBound(T other)
      Calculate the lower bound of this marker and given other marker. The result must represent the lowest of the given markers. This may either be on of this or the other marker, or any other that represents their lower bound.
      Parameters:
      other - The other marker.
      Returns:
      A marker representing the lower bound of this and the other marker.
    • doUpperBound

      protected abstract ConsistencyMarker doUpperBound(T other)
      Calculate the upper bound of this marker and given other marker. The result must represent the highest of the given markers. This may either be on of this or the other marker, or any other that represents their upper bound.
      Parameters:
      other - The other marker.
      Returns:
      A marker representing the upper bound of this and the other marker.