Class PlatformDotNetAffinityFunction
- java.lang.Object
- 
- org.apache.ignite.platform.dotnet.PlatformDotNetAffinityFunction
 
- 
- All Implemented Interfaces:
- Externalizable,- Serializable,- AffinityFunction,- LifecycleAware
 
 public class PlatformDotNetAffinityFunction extends Object implements AffinityFunction, Externalizable, LifecycleAware AffinityFunction implementation which can be used to configure .NET affinity function in Java Spring configuration.- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description PlatformDotNetAffinityFunction()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description List<List<ClusterNode>>assignPartitions(AffinityFunctionContext affCtx)Gets affinity nodes for a partition.org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunctiongetFunc()Gets the inner func.Map<String,?>getProperties()Get properties.StringgetTypeName()Gets .NET type name.voidinit(org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction func)Initializes this instance.intpartition(Object key)Gets partition number for a given key starting from0.intpartitions()Gets total number of partitions available.voidreadExternal(ObjectInput in)voidremoveNode(UUID nodeId)Removes node from affinity.voidreset()Resets cache affinity to its initial state.PlatformDotNetAffinityFunctionsetProperties(Map<String,?> props)Set properties.PlatformDotNetAffinityFunctionsetTypeName(String typName)Sets .NET type name.voidstart()Starts grid component, called on grid start.voidstop()Stops grid component, called on grid shutdown.voidwriteExternal(ObjectOutput out)
 
- 
- 
- 
Method Detail- 
getTypeNamepublic String getTypeName() Gets .NET type name.- Returns:
- .NET type name.
 
 - 
setTypeNamepublic PlatformDotNetAffinityFunction setTypeName(String typName) Sets .NET type name.- Parameters:
- typName- .NET type name.
- Returns:
- thisfor chaining.
 
 - 
setPropertiespublic PlatformDotNetAffinityFunction setProperties(Map<String,?> props) Set properties.- Parameters:
- props- Properties.
- Returns:
- thisfor chaining.
 
 - 
resetpublic void reset() Resets cache affinity to its initial state. This method will be called by the system any time the affinity has been sent to remote node where it has to be reinitialized. If your implementation of affinity function has no initialization logic, leave this method empty.- Specified by:
- resetin interface- AffinityFunction
 
 - 
partitionspublic int partitions() Gets total number of partitions available. All caches should always provide correct partition count which should be the same on all participating nodes. Note that partitions should always be numbered from0inclusively toNexclusively without any gaps.- Specified by:
- partitionsin interface- AffinityFunction
- Returns:
- Total partition count.
 
 - 
partitionpublic int partition(Object key) Gets partition number for a given key starting from0. Partitioned caches should make sure that keys are about evenly distributed across all partitions from0topartition countfor best performance.Note that for fully replicated caches it is possible to segment key sets among different grid node groups. In that case each node group should return a unique partition number. However, unlike partitioned cache, mappings of keys to nodes in replicated caches are constant and a node cannot migrate from one partition to another. - Specified by:
- partitionin interface- AffinityFunction
- Parameters:
- key- Key to get partition for.
- Returns:
- Partition number for a given key.
 
 - 
assignPartitionspublic List<List<ClusterNode>> assignPartitions(AffinityFunctionContext affCtx) Gets affinity nodes for a partition. In case of replicated cache, all returned nodes are updated in the same manner. In case of partitioned cache, the returned list should contain only the primary and back up nodes with primary node being always first.Note that partitioned affinity must obey the following contract: given that node Nis primary for some keyK, if any other node(s) leave grid and no node joins grid, nodeNwill remain primary for keyK.- Specified by:
- assignPartitionsin interface- AffinityFunction
- Parameters:
- affCtx- Affinity function context. Will provide all required information to calculate new partition assignments.
- Returns:
- Unmodifiable list indexed by partition number. Each element of array is a collection in which first node is a primary node and other nodes are backup nodes.
 
 - 
removeNodepublic void removeNode(UUID nodeId) Removes node from affinity. This method is called when it is safe to remove left node from affinity mapping.- Specified by:
- removeNodein interface- AffinityFunction
- Parameters:
- nodeId- ID of node to remove.
 
 - 
writeExternalpublic void writeExternal(ObjectOutput out) throws IOException - Specified by:
- writeExternalin interface- Externalizable
- Throws:
- IOException
 
 - 
readExternalpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException - Specified by:
- readExternalin interface- Externalizable
- Throws:
- IOException
- ClassNotFoundException
 
 - 
initpublic void init(org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction func) Initializes this instance.- Parameters:
- func- Underlying func.
 
 - 
startpublic void start() throws IgniteExceptionStarts grid component, called on grid start.- Specified by:
- startin interface- LifecycleAware
- Throws:
- IgniteException- If failed.
 
 - 
stoppublic void stop() throws IgniteExceptionStops grid component, called on grid shutdown.- Specified by:
- stopin interface- LifecycleAware
- Throws:
- IgniteException- If failed.
 
 - 
getFuncpublic org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction getFunc() Gets the inner func.- Returns:
- The inner func.
 
 
- 
 
-