Class GridDhtPartitionsReservation

  • All Implemented Interfaces:
    GridReservable

    public class GridDhtPartitionsReservation
    extends Object
    implements GridReservable
    Reservation mechanism for multiple partitions allowing to do a reservation in one operation.
    • Constructor Detail

      • GridDhtPartitionsReservation

        public GridDhtPartitionsReservation​(AffinityTopologyVersion topVer,
                                            GridCacheContext<?,​?> cctx,
                                            Object appKey)
        Parameters:
        topVer - AffinityTopologyVersion version.
        cctx - Cache context.
        appKey - Application key for reservation.
    • Method Detail

      • register

        public boolean register​(Collection<? extends GridReservable> parts)
        Registers all the given partitions for this reservation.
        Parameters:
        parts - Partitions.
        Returns:
        true If registration succeeded and this reservation can be published.
      • onPublish

        public void onPublish​(CI1<GridDhtPartitionsReservation> unpublish)
        Must be called when this reservation is published.
        Parameters:
        unpublish - Closure to unpublish this reservation when it will become invalid.
      • reserve

        public boolean reserve()
        Reserves all the registered partitions.
        Specified by:
        reserve in interface GridReservable
        Returns:
        true If succeeded.
      • release

        public void release()
        Releases all the registered partitions.
        Specified by:
        release in interface GridReservable
      • invalidate

        public boolean invalidate()
        If returns true this reservation object becomes invalid and partitions can be evicted or at least cleared. Also this means that after returning true here method reserve() can not return true anymore.
        Returns:
        true If this reservation was successfully invalidated because it was not reserved and partitions can be evicted.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object