Class DefaultIracManager

  • All Implemented Interfaces:
    Runnable, IracManager

    public class DefaultIracManager
    extends Object
    implements IracManager, Runnable
    Default implementation of IracManager.

    It tracks the keys updated by this site and sends them, periodically, to the configured remote sites.

    The primary owner coordinates everything. It sends the updates request to the remote site and coordinates the local site backup owners. After sending the updates to the remote site, it sends a cleanup request to the local site backup owners

    The backup owners only keeps a backup list of the tracked keys.

    On topology change, the updated keys list is replicate to the new owner(s). Also, if a segment is being transferred (i.e. the primary owner isn't a write and read owner), no updates to the remote site is sent since, most likely, the node doesn't have the most up-to-date value.

    Since:
    11.0
    Author:
    Pedro Ruivo
    • Constructor Detail

      • DefaultIracManager

        public DefaultIracManager()
    • Method Detail

      • start

        public void start()
      • stop

        public void stop()
      • trackUpdatedKey

        public void trackUpdatedKey​(Object key,
                                    Object lockOwner)
        Description copied from interface: IracManager
        Sets the key as changed by the lockOwner.
        Specified by:
        trackUpdatedKey in interface IracManager
        Parameters:
        key - The key changed.
        lockOwner - The lock owner who updated the key.
      • trackUpdatedKeys

        public <K> void trackUpdatedKeys​(Collection<K> keys,
                                         Object lockOwner)
        Description copied from interface: IracManager
        Sets all the keys in keys as changed by the lockOwner.
        Specified by:
        trackUpdatedKeys in interface IracManager
        Parameters:
        keys - A Collection of keys changed.
        lockOwner - The lock owner who updated the keys.
      • trackClear

        public void trackClear()
        Description copied from interface: IracManager
        Sets all keys as removed.
        Specified by:
        trackClear in interface IracManager
      • cleanupKey

        public void cleanupKey​(Object key,
                               Object lockOwner,
                               IracMetadata tombstone)
        Description copied from interface: IracManager
        Sets the key as not changed and remove any tombstone related to it.

        If lockOwner isn't the last one who updated the key, this method is a no-op.

        Specified by:
        cleanupKey in interface IracManager
        Parameters:
        key - The key.
        lockOwner - The lock owner who updated the key.
        tombstone - The tombstone (can be null).
      • requestState

        public void requestState​(Address origin,
                                 org.infinispan.commons.util.IntSet segments)
        Description copied from interface: IracManager
        Requests the state stored in this instance for the given segments.
        Specified by:
        requestState in interface IracManager
        Parameters:
        origin - The requestor.
        segments - The segments requested.
      • receiveState

        public void receiveState​(Object key,
                                 Object lockOwner,
                                 IracMetadata tombstone)
        Description copied from interface: IracManager
        Receives the state related to the key.
        Specified by:
        receiveState in interface IracManager
        Parameters:
        key - The key modified.
        lockOwner - The last lockOwner.
        tombstone - The tombstone (can be null)
      • sendStateIfNeeded

        public void sendStateIfNeeded​(Address origin,
                                      org.infinispan.commons.util.IntSet segments,
                                      Object key,
                                      Object lockOwner)
      • run

        public void run()
        Specified by:
        run in interface Runnable
      • isEmpty

        public boolean isEmpty()