@ThreadSafe public class KeyAffinityServiceImpl<K> extends Object implements KeyAffinityService<K>
Modifier and Type | Field and Description |
---|---|
static float |
THRESHOLD |
Constructor and Description |
---|
KeyAffinityServiceImpl(Executor executor,
Cache<? extends K,?> cache,
KeyGenerator<? extends K> keyGenerator,
int bufferSize,
Collection<Address> filter,
boolean start) |
Modifier and Type | Method and Description |
---|---|
Map<Address,BlockingQueue<K>> |
getAddress2KeysMapping() |
K |
getCollocatedKey(K otherKey)
Returns a key that will be distributed on the same node as the supplied key.
|
K |
getKeyForAddress(Address address)
Returns a key that will be distributed on the cluster node identified by address.
|
int |
getMaxNumberOfKeys() |
void |
handleCacheStopped(CacheStoppedEvent cse) |
void |
handleViewChange(TopologyChangedEvent<?,?> vce) |
boolean |
isKeyGeneratorThreadActive() |
boolean |
isKeyGeneratorThreadAlive() |
boolean |
isStarted()
Checks weather or not the service is started.
|
void |
start() |
void |
stop() |
public static final float THRESHOLD
public KeyAffinityServiceImpl(Executor executor, Cache<? extends K,?> cache, KeyGenerator<? extends K> keyGenerator, int bufferSize, Collection<Address> filter, boolean start)
public K getCollocatedKey(K otherKey)
KeyAffinityService
getCollocatedKey
in interface KeyAffinityService<K>
otherKey
- the key for which we need a collocationpublic K getKeyForAddress(Address address)
KeyAffinityService
getKeyForAddress
in interface KeyAffinityService<K>
address
- identifying the cluster node.public void handleViewChange(TopologyChangedEvent<?,?> vce)
public boolean isKeyGeneratorThreadAlive()
public void handleCacheStopped(CacheStoppedEvent cse)
public Map<Address,BlockingQueue<K>> getAddress2KeysMapping()
public int getMaxNumberOfKeys()
public boolean isKeyGeneratorThreadActive()
public boolean isStarted()
KeyAffinityService
isStarted
in interface KeyAffinityService<K>
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.