Class GridCacheDefaultAffinityKeyMapper
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper
-
- All Implemented Interfaces:
Serializable,AffinityKeyMapper
- Direct Known Subclasses:
CacheDefaultBinaryAffinityKeyMapper
public class GridCacheDefaultAffinityKeyMapper extends Object implements AffinityKeyMapper
Default key affinity mapper. If key class has annotationAffinityKeyMapped, then the value of annotated field will be used to get affinity value instead of the key itself. If there is no annotation, then the key is used as is.Convenience affinity key adapter,
AffinityKeycan be used in conjunction with this mapper to automatically provide custom affinity keys for cache keys.If non-default affinity mapper is used, is should be provided via
CacheConfiguration.getAffinityMapper()configuration property.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected IgniteigniteInjected ignite instance.protected IgniteLoggerlogLogger.
-
Constructor Summary
Constructors Constructor Description GridCacheDefaultAffinityKeyMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectaffinityKey(Object key)If key class has annotationAffinityKeyMapped, then the value of annotated method or field will be used to get affinity value instead of the key itself.@Nullable StringaffinityKeyPropertyName(Class<?> cls)voidignite(Ignite ignite)voidreset()Resets cache affinity mapper to its initial state.
-
-
-
Field Detail
-
ignite
protected transient Ignite ignite
Injected ignite instance.
-
log
@LoggerResource protected transient IgniteLogger log
Logger.
-
-
Method Detail
-
affinityKey
public Object affinityKey(Object key)
If key class has annotationAffinityKeyMapped, then the value of annotated method or field will be used to get affinity value instead of the key itself. If there is no annotation, then the key is returned as is.- Specified by:
affinityKeyin interfaceAffinityKeyMapper- Parameters:
key- Key to get affinity key for.- Returns:
- Affinity key for given key.
-
affinityKeyPropertyName
@Nullable public @Nullable String affinityKeyPropertyName(Class<?> cls)
- Parameters:
cls- Key class.- Returns:
- Name of
-
ignite
@IgniteInstanceResource public void ignite(Ignite ignite)
- Parameters:
ignite- Ignite.
-
reset
public void reset()
Resets cache affinity mapper to its initial state. This method will be called by the system any time the affinity mapper has been sent to remote node where it has to be reinitialized. If your implementation of affinity mapper has no initialization logic, leave this method empty.- Specified by:
resetin interfaceAffinityKeyMapper
-
-