Class StreamSeedUpdater

  • All Implemented Interfaces:
    Serializable, StreamUpdater

    public class StreamSeedUpdater
    extends Object
    implements StreamUpdater
    StreamSeedUpdater updates the streams based on a stored map of replication numbers to seed numbers.

    Copyright (c) 2021-2023 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information DSOL Manual. The DSOL project is distributed under a three-clause BSD-style license, which can be found at DSOL License.

    Author:
    Alexander Verbraeck
    See Also:
    Serialized Form
    • Constructor Detail

      • StreamSeedUpdater

        public StreamSeedUpdater​(Map<String,​Map<Integer,​Long>> streamSeedMap)
        Construct a new StreamSeedUpdater object an initialize it with the seed map.
        Parameters:
        streamSeedMap - Map<String, Map<Integer, Long>>; the stored seed maps
    • Method Detail

      • updateSeed

        public void updateSeed​(String streamId,
                               StreamInterface stream,
                               int replicationNumber)
        Update one seed for the given streamId and replication number. The method should be fully reproducible, and can be based on the previous seed value of the stream, possibly the String representation, and the replication number.
        Specified by:
        updateSeed in interface StreamUpdater
        Parameters:
        streamId - String; the id of the stream to update
        stream - StreamInterface; the stream to update for this replication
        replicationNumber - int; the replication number for which to set the seed value
      • getFallbackStreamUpdater

        public StreamUpdater getFallbackStreamUpdater()
        Return the fallback stream updater in case the stream or the replication is not in the seed map.
        Returns:
        fallbackStreamUpdater StreamUpdater; the fallback stream updater in case the stream or the replication is not in the seed map.
      • setFallbackStreamUpdater

        public void setFallbackStreamUpdater​(StreamUpdater fallbackStreamUpdater)
        Set a new fallback stream updater in case the stream or the replication is not in the seed map.
        Parameters:
        fallbackStreamUpdater - StreamUpdater; the new fallback stream updater in case the stream or the replication is not in the seed map.
        Throws:
        NullPointerException - when fallbackStreamUpdater is null
      • getStreamSeedMap

        public Map<String,​Map<Integer,​Long>> getStreamSeedMap()
        Return the available seed maps for all stored streams, mapping stream ids to seed maps.
        Returns:
        Map<String, Map<Integer, Long>>; the stored seed maps