org.infinispan.affinity
Class KeyAffinityServiceImpl

java.lang.Object
  extended by org.infinispan.affinity.KeyAffinityServiceImpl
All Implemented Interfaces:
KeyAffinityService, Lifecycle

@ThreadSafe
public class KeyAffinityServiceImpl
extends Object
implements KeyAffinityService

Implementation of KeyAffinityService.

Since:
4.1
Author:
Mircea.Markus@jboss.com

Nested Class Summary
 class KeyAffinityServiceImpl.KeyGeneratorWorker
           
 
Constructor Summary
KeyAffinityServiceImpl(Executor executor, Cache cache, KeyGenerator keyGenerator, int bufferSize, Collection<Address> filter, boolean start)
           
 
Method Summary
 Map<Address,BlockingQueue> getAddress2KeysMapping()
           
 Object getCollocatedKey(Object otherKey)
          Returns a key that will be distributed on the same node as the supplied key.
 int getExitingNumberOfKeys()
           
 Object 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(ViewChangedEvent vce)
           
 boolean isKeyGeneratorThreadActive()
           
 boolean isKeyGeneratorThreadAlive()
           
 boolean isStarted()
          Checks weather or not the service is started.
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyAffinityServiceImpl

public KeyAffinityServiceImpl(Executor executor,
                              Cache cache,
                              KeyGenerator keyGenerator,
                              int bufferSize,
                              Collection<Address> filter,
                              boolean start)
Method Detail

getCollocatedKey

public Object getCollocatedKey(Object 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
Parameters:
otherKey - the key for which we need a collocation
Returns:
a key object

getKeyForAddress

public Object 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
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(ViewChangedEvent vce)

isKeyGeneratorThreadAlive

public boolean isKeyGeneratorThreadAlive()

handleCacheStopped

public void handleCacheStopped(CacheStoppedEvent cse)

getAddress2KeysMapping

public Map<Address,BlockingQueue> getAddress2KeysMapping()

getMaxNumberOfKeys

public int getMaxNumberOfKeys()

getExitingNumberOfKeys

public int getExitingNumberOfKeys()

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

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.