Interface GridDhtTopologyFuture
-
- All Superinterfaces:
IgniteInternalFuture<AffinityTopologyVersion>
- All Known Implementing Classes:
GridDhtPartitionsExchangeFuture,GridDhtTopologyFutureAdapter
public interface GridDhtTopologyFuture extends IgniteInternalFuture<AffinityTopologyVersion>
Future that implements a barrier after which dht topology is safe to use. Topology is considered to be safe to use when all transactions that involve moving primary partitions are completed and partition map exchange is also completed. When new cache operation is started, it will wait for this future before acquiring new locks on particular topology version.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanchangedAffinity()booleanexchangeDone()Ready affinity future (GridCachePartitionExchangeManager.affinityReadyFuture(AffinityTopologyVersion)is completed beforeGridFutureAdapter.onDone(Object, Throwable)is called onGridDhtPartitionsExchangeFuture, it is guaranteed that this method will returntrueif affinity ready future is finished.AffinityTopologyVersioninitialVersion()Returns topology version when exchange started.AffinityTopologyVersiontopologyVersion()Gets result topology version of this future.@Nullable CacheInvalidStateExceptionvalidateCache(GridCacheContext cctx, boolean recovery, boolean read, @Nullable Object key, @Nullable Collection<?> keys)Returns error is cache topology is not valid.-
Methods inherited from interface org.apache.ignite.internal.IgniteInternalFuture
cancel, chain, chain, chain, chain, chainCompose, chainCompose, error, get, get, get, getUninterruptibly, isCancelled, isDone, listen, listen, result
-
-
-
-
Method Detail
-
initialVersion
AffinityTopologyVersion initialVersion()
Returns topology version when exchange started. It can differ from result topology version if exchanges for multiple discovery events are merged. Initial version should not be used as version for cache operation since it is possible affinity for this version is never calculated.- Returns:
- Topology version when exchange started.
-
topologyVersion
AffinityTopologyVersion topologyVersion()
Gets result topology version of this future. Result version can differ from initial exchange version if exchanges for multiple discovery events are merged, in this case result version is version of last discovery event.This method should be called only for finished topology future since result version is not known before exchange finished.
- Returns:
- Result topology version.
-
exchangeDone
boolean exchangeDone()
Ready affinity future (GridCachePartitionExchangeManager.affinityReadyFuture(AffinityTopologyVersion)is completed beforeGridFutureAdapter.onDone(Object, Throwable)is called onGridDhtPartitionsExchangeFuture, it is guaranteed that this method will returntrueif affinity ready future is finished.Also this method returns
falsefor merged exchange futures.- Returns:
Trueif exchange is finished and result topology version can be used.
-
validateCache
@Nullable @Nullable CacheInvalidStateException validateCache(GridCacheContext cctx, boolean recovery, boolean read, @Nullable @Nullable Object key, @Nullable @Nullable Collection<?> keys)
Returns error is cache topology is not valid.- Parameters:
cctx- Cache context.recovery-Trueif cache operation is done in recovery mode. Then it will only check for cache active state and topology validator result.read-Trueif validating read operation,falseif validating write.key- Key (optimization to avoid collection creation).keys- Keys involved in a cache operation.- Returns:
- Not null exception if a cache is in invalid state.
-
changedAffinity
boolean changedAffinity()
- Returns:
Trueif this exchange changed affinity.
-
-