public class GridCacheAffinityManager<K,V> extends GridCacheManagerAdapter<K,V>
cctx, log| Constructor and Description |
|---|
GridCacheAffinityManager() |
| Modifier and Type | Method and Description |
|---|---|
GridFuture<Long> |
affinityReadyFuture(long topVer)
Gets affinity ready future, a future that will be completed after affinity with given
topology version is calculated.
|
long |
affinityTopologyVersion() |
List<List<GridNode>> |
assignments(long topVer) |
Set<Integer> |
backupPartitions(UUID nodeId,
long topVer) |
Collection<GridNode> |
backups(int part,
long topVer) |
Collection<GridNode> |
backups(K key,
long topVer) |
boolean |
belongs(GridNode node,
int part,
long topVer) |
List<List<GridNode>> |
calculateAffinity(long topVer,
GridDiscoveryEvent discoEvt)
Calculates affinity cache for given topology version.
|
void |
cleanUpCache(long topVer)
Clean up outdated cache items.
|
void |
initializeAffinity(long topVer,
List<List<GridNode>> affAssignment)
Initializes affinity for joined node.
|
boolean |
localNode(int part,
long topVer) |
boolean |
localNode(K key,
long topVer) |
Collection<GridNode> |
nodes(int part,
long topVer) |
Collection<GridNode> |
nodes(K key,
long topVer) |
protected void |
onKernalStart0() |
<T> int |
partition(T key)
NOTE: Use this method always when you need to calculate partition id for
a key provided by user.
|
GridPartitionLockKey |
partitionAffinityKey(int partId)
Gets partition affinity key for given partition id.
|
int |
partitions() |
boolean |
primary(GridNode n,
int part,
long topVer) |
boolean |
primary(GridNode n,
K key,
long topVer) |
GridNode |
primary(int part,
long topVer) |
GridNode |
primary(K key,
long topVer) |
Set<Integer> |
primaryPartitions(UUID nodeId,
long topVer) |
Collection<GridNode> |
remoteNodes(Iterable<? extends K> keys,
long topVer) |
void |
start0() |
protected void |
stop0(boolean cancel) |
context, kernalStartInfo, kernalStopInfo, log, onKernalStart, onKernalStop, onKernalStop0, printMemoryStats, start, startInfo, stop, stopInfo, toStringpublic void start0()
throws GridException
start0 in class GridCacheManagerAdapter<K,V>GridException - If failed.protected void onKernalStart0()
throws GridException
onKernalStart0 in class GridCacheManagerAdapter<K,V>GridException - If failed.protected void stop0(boolean cancel)
stop0 in class GridCacheManagerAdapter<K,V>cancel - Cancel flag.public GridFuture<Long> affinityReadyFuture(long topVer)
topVer - Topology version to affinity for.public void cleanUpCache(long topVer)
topVer - Actual topology version, older versions will be removed.public void initializeAffinity(long topVer,
List<List<GridNode>> affAssignment)
topVer - Topology version.affAssignment - Affinity assignment for this topology version.public List<List<GridNode>> assignments(long topVer)
topVer - Topology version.public List<List<GridNode>> calculateAffinity(long topVer, GridDiscoveryEvent discoEvt)
topVer - Topology version to calculate affinity for.discoEvt - Discovery event that causes this topology change.public int partitions()
public GridPartitionLockKey partitionAffinityKey(int partId)
partId - Partition ID.public <T> int partition(T key)
key - Key.public Collection<GridNode> nodes(K key, long topVer)
key - Key.topVer - Topology version.public Collection<GridNode> nodes(int part, long topVer)
part - Partition.topVer - Topology version.@Nullable public GridNode primary(K key, long topVer)
key - Key to check.topVer - Topology version.@Nullable public GridNode primary(int part, long topVer)
part - Partition.topVer - Topology version.public boolean primary(GridNode n, K key, long topVer)
n - Node to check.key - Key to check.topVer - Topology version.True if checked node is primary for given key.public boolean primary(GridNode n, int part, long topVer)
n - Node to check.part - Partition.topVer - Topology version.True if checked node is primary for given key.public Collection<GridNode> backups(K key, long topVer)
key - Key to check.topVer - Topology version.public Collection<GridNode> backups(int part, long topVer)
part - Partition.topVer - Topology version.public Collection<GridNode> remoteNodes(Iterable<? extends K> keys, long topVer)
keys - keys.topVer - Topology version.public boolean localNode(K key, long topVer)
key - Key to check.topVer - Topology version.true if given key belongs to local node.public boolean localNode(int part,
long topVer)
part - Partition number to check.topVer - Topology version.true if given partition belongs to local node.public boolean belongs(GridNode node, int part, long 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, long topVer)
nodeId - Node ID.topVer - Topology version to calculate affinity.public Set<Integer> backupPartitions(UUID nodeId, long topVer)
nodeId - Node ID.topVer - Topology version to calculate affinity.public long affinityTopologyVersion()
Copyright © 2014. All rights reserved.