Class GridDhtPartitionsReservation
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.distributed.dht.topology.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 Summary
Constructors Constructor Description GridDhtPartitionsReservation(AffinityTopologyVersion topVer, GridCacheContext<?,?> cctx, Object appKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)inthashCode()booleaninvalidate()If returnstruethis reservation object becomes invalid and partitions can be evicted or at least cleared.voidonPublish(CI1<GridDhtPartitionsReservation> unpublish)Must be called when this reservation is published.booleanregister(Collection<? extends GridReservable> parts)Registers all the given partitions for this reservation.voidrelease()Releases all the registered partitions.booleanreserve()Reserves all the registered partitions.StringtoString()
-
-
-
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:
trueIf 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:
reservein interfaceGridReservable- Returns:
trueIf succeeded.
-
release
public void release()
Releases all the registered partitions.- Specified by:
releasein interfaceGridReservable
-
invalidate
public boolean invalidate()
If returnstruethis reservation object becomes invalid and partitions can be evicted or at least cleared. Also this means that after returningtruehere methodreserve()can not returntrueanymore.- Returns:
trueIf this reservation was successfully invalidated because it was not reserved and partitions can be evicted.
-
-