org.infinispan.affinity
Class KeyAffinityServiceImpl<K>
java.lang.Object
org.infinispan.affinity.KeyAffinityServiceImpl<K>
- All Implemented Interfaces:
- KeyAffinityService<K>, Lifecycle
@ThreadSafe
public class KeyAffinityServiceImpl<K>
- extends Object
- implements KeyAffinityService<K>
Implementation of KeyAffinityService.
- Since:
- 4.1
- Author:
- Mircea.Markus@jboss.com
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
THRESHOLD
public static final float THRESHOLD
- See Also:
- Constant Field Values
KeyAffinityServiceImpl
public KeyAffinityServiceImpl(Executor executor,
Cache<? extends K,?> cache,
KeyGenerator<? extends K> keyGenerator,
int bufferSize,
Collection<Address> filter,
boolean start)
getCollocatedKey
public K getCollocatedKey(K otherKey)
- Description copied from interface:
KeyAffinityService
- Returns a key that will be distributed on the same node as the supplied key.
- Specified by:
getCollocatedKey
in interface KeyAffinityService<K>
- Parameters:
otherKey
- the key for which we need a collocation
- Returns:
- a key object
getKeyForAddress
public K getKeyForAddress(Address address)
- Description copied from interface:
KeyAffinityService
- Returns a key that will be distributed on the cluster node identified by address.
- Specified by:
getKeyForAddress
in interface KeyAffinityService<K>
- Parameters:
address
- identifying the cluster node.
- Returns:
- a key object
start
public void start()
- Specified by:
start
in interface Lifecycle
stop
public void stop()
- Specified by:
stop
in interface Lifecycle
handleViewChange
public void handleViewChange(TopologyChangedEvent<?,?> vce)
isKeyGeneratorThreadAlive
public boolean isKeyGeneratorThreadAlive()
handleCacheStopped
public void handleCacheStopped(CacheStoppedEvent cse)
getAddress2KeysMapping
public Map<Address,BlockingQueue<K>> getAddress2KeysMapping()
getMaxNumberOfKeys
public int getMaxNumberOfKeys()
isKeyGeneratorThreadActive
public boolean isKeyGeneratorThreadActive()
isStarted
public boolean isStarted()
- Description copied from interface:
KeyAffinityService
- Checks weather or not the service is started.
- Specified by:
isStarted
in interface KeyAffinityService<K>
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.