public class GridCacheAffinityManager extends GridCacheManagerAdapter
cctx, log, starting
Constructor and Description |
---|
GridCacheAffinityManager() |
context, kernalStartInfo, kernalStopInfo, log, onKernalStart, onKernalStop, printMemoryStats, start, startInfo, stop, stopInfo, toString
public void start0() throws IgniteCheckedException
start0
in class GridCacheManagerAdapter
IgniteCheckedException
- If failed.protected void onKernalStart0() throws IgniteCheckedException
onKernalStart0
in class GridCacheManagerAdapter
IgniteCheckedException
- If failed.protected void onKernalStop0(boolean cancel)
onKernalStop0
in class GridCacheManagerAdapter
cancel
- Cancel flag.public void cancelFutures()
public void onDisconnected(IgniteFuture reconnectFut)
onDisconnected
in interface GridCacheManager
onDisconnected
in class GridCacheManagerAdapter
reconnectFut
- Reconnect future.public void onReconnected()
protected void stop0(boolean cancel, boolean destroy)
stop0
in class GridCacheManagerAdapter
cancel
- Cancel flag.destroy
- Cache destroy flag.public IgniteInternalFuture<AffinityTopologyVersion> affinityReadyFuture(long topVer)
topVer
- Topology version to wait.public IgniteInternalFuture<AffinityTopologyVersion> affinityReadyFuture(AffinityTopologyVersion topVer)
topVer
- Topology version to wait.@Nullable public IgniteInternalFuture<AffinityTopologyVersion> affinityReadyFuturex(AffinityTopologyVersion topVer)
null
if topology with given version is ready by the moment method is invoked.topVer
- Topology version to wait.null
.public List<List<ClusterNode>> assignments(AffinityTopologyVersion topVer)
topVer
- Topology version.public List<List<ClusterNode>> idealAssignment()
public int partitions()
public int partition(Object key)
key
- Key.public int partition(Object key, boolean useKeyPart)
key
- Key.useKeyPart
- If true
can use pre-calculated partition stored in KeyCacheObject.public Object affinityKey(Object key)
GridCacheInternal
entry when won't passed into user's mapper and
will use default
.key
- Key.public List<ClusterNode> nodesByKey(Object key, AffinityTopologyVersion topVer)
key
- Key.topVer
- Topology version.public List<ClusterNode> nodesByPartition(int part, AffinityTopologyVersion topVer)
part
- Partition.topVer
- Topology version.public AffinityAssignment assignment(AffinityTopologyVersion topVer)
topVer
- Topology version.@Nullable public ClusterNode primaryByKey(Object key, AffinityTopologyVersion topVer)
key
- Key to check.topVer
- Topology version.@Nullable public ClusterNode primaryByPartition(int part, AffinityTopologyVersion topVer)
part
- Partition.topVer
- Topology version.public boolean primaryByKey(ClusterNode n, Object key, AffinityTopologyVersion topVer)
n
- Node to check.key
- Key to check.topVer
- Topology version.True
if checked node is primary for given key.public boolean primaryByPartition(ClusterNode n, int part, AffinityTopologyVersion topVer)
n
- Node to check.part
- Partition.topVer
- Topology version.True
if checked node is primary for given partition.public Collection<ClusterNode> backupsByKey(Object key, AffinityTopologyVersion topVer)
key
- Key to check.topVer
- Topology version.public boolean backupByPartition(ClusterNode n, int part, AffinityTopologyVersion topVer)
n
- Node to check.part
- Partition.topVer
- Topology version.True
if checked node is a backup node for given partition.public boolean keyLocalNode(Object key, AffinityTopologyVersion topVer)
key
- Key to check.topVer
- Topology version.true
if given key belongs to local node.public boolean partitionLocalNode(int part, AffinityTopologyVersion topVer)
part
- Partition number to check.topVer
- Topology version.true
if given partition belongs to local node.public boolean partitionBelongs(ClusterNode node, int part, AffinityTopologyVersion topVer)
node
- Node.part
- Partition number to check.topVer
- Topology version.true
if given partition belongs to specified node.public Set<Integer> primaryPartitions(UUID nodeId, AffinityTopologyVersion topVer)
nodeId
- Node ID.topVer
- Topology version to calculate affinity.public Set<Integer> backupPartitions(UUID nodeId, AffinityTopologyVersion topVer)
nodeId
- Node ID.topVer
- Topology version to calculate affinity.public AffinityTopologyVersion affinityTopologyVersion()
public void dumpDebugInfo()
public GridAffinityAssignmentCache affinityCache()
public boolean primaryChanged(int part, AffinityTopologyVersion startVer, AffinityTopologyVersion endVer)
part
- Partition.startVer
- Start version.endVer
- End version.True
if primary changed or required affinity version not found in history.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017