Class CommitManager


  • public class CommitManager
    extends Object
    Keeps track of the keys updated by normal operation and state transfer. Since the command processing happens concurrently with the state transfer, it needs to keep track of the keys updated by normal command in order to reject the updates from the state transfer. It assumes that the keys from normal operations are most recent thant the ones received by state transfer.
    Since:
    7.0
    Author:
    Pedro Ruivo
    • Constructor Detail

      • CommitManager

        public CommitManager()
    • Method Detail

      • startTrack

        public final void startTrack​(Flag track)
        It starts tracking keys committed. All the keys committed will be flagged with this flag. State transfer received after the key is tracked will be discarded.
        Parameters:
        track - Flag to start tracking keys for local site state transfer or for remote site state transfer.
      • stopTrack

        public final void stopTrack​(Flag track)
        It stops tracking keys committed.
        Parameters:
        track - Flag to stop tracking keys for local site state transfer or for remote site state transfer.
      • commit

        public final void commit​(CacheEntry entry,
                                 Flag operation,
                                 int segment,
                                 boolean l1Only,
                                 InvocationContext ctx)
        It tries to commit the cache entry. The entry is not committed if it is originated from state transfer and other operation already has updated it.
        Parameters:
        entry - the entry to commit
        operation - if null, it identifies this commit as originated from a normal operation. Otherwise, it
        ctx -
      • isTracking

        public final boolean isTracking​(Flag trackFlag)
        Returns:
        true if the flag is being tracked, false otherwise.
      • isEmpty

        public final boolean isEmpty()
        Returns:
        true if no keys are tracked, false otherwise.