Package org.infinispan.affinity.impl
Class KeyAffinityServiceImpl<K>
java.lang.Object
org.infinispan.affinity.impl.KeyAffinityServiceImpl<K>
- All Implemented Interfaces:
KeyAffinityService<K>,Lifecycle
Implementation of KeyAffinityService.
- Since:
- 4.1
- Author:
- Mircea.Markus@jboss.com
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionKeyAffinityServiceImpl(Executor executor, Cache<? extends K, ?> cache, KeyGenerator<? extends K> keyGenerator, int bufferSize, Collection<Address> filter, boolean start) -
Method Summary
Modifier and TypeMethodDescriptiongetCollocatedKey(K otherKey) Returns a key that will be distributed on the same node as the supplied key.getKeyForAddress(Address address) Returns a key that will be distributed on the cluster node identified by address.intvoidvoidhandleViewChange(TopologyChangedEvent<?, ?> vce) booleanbooleanbooleanChecks weather or not the service is started.voidstart()Invoked on component startvoidstop()Invoked on component stop
-
Field Details
-
THRESHOLD
public static final float THRESHOLD- See Also:
-
-
Constructor Details
-
KeyAffinityServiceImpl
public KeyAffinityServiceImpl(Executor executor, Cache<? extends K, ?> cache, KeyGenerator<? extends K> keyGenerator, int bufferSize, Collection<Address> filter, boolean start)
-
-
Method Details
-
getCollocatedKey
Description copied from interface:KeyAffinityServiceReturns a key that will be distributed on the same node as the supplied key.- Specified by:
getCollocatedKeyin interfaceKeyAffinityService<K>- Parameters:
otherKey- the key for which we need a collocation- Returns:
- a key object
-
getKeyForAddress
Description copied from interface:KeyAffinityServiceReturns a key that will be distributed on the cluster node identified by address.- Specified by:
getKeyForAddressin interfaceKeyAffinityService<K>- Parameters:
address- identifying the cluster node.- Returns:
- a key object
-
start
public void start()Description copied from interface:LifecycleInvoked on component start -
stop
public void stop()Description copied from interface:LifecycleInvoked on component stop -
handleViewChange
-
isKeyGeneratorThreadAlive
public boolean isKeyGeneratorThreadAlive() -
handleCacheStopped
-
getAddress2KeysMapping
-
getMaxNumberOfKeys
public int getMaxNumberOfKeys() -
isKeyGeneratorThreadActive
public boolean isKeyGeneratorThreadActive() -
isStarted
public boolean isStarted()Description copied from interface:KeyAffinityServiceChecks weather or not the service is started.- Specified by:
isStartedin interfaceKeyAffinityService<K>
-