| 
 | Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
   com.tangosol.util.Base
com.tangosol.util.Base
       com.tangosol.util.BitHelper
com.tangosol.util.BitHelper
           com.tangosol.util.ExternalizableHelper
com.tangosol.util.ExternalizableHelper
               com.tangosol.net.partition.DefaultKeyPartitioningStrategy
com.tangosol.net.partition.DefaultKeyPartitioningStrategy
public class DefaultKeyPartitioningStrategy
DefaultKeyPartitioningStrategy provides a simple strategy for assigning keys to partitions which is based on the hash code of keys in internal (serialized to Binary) form.
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from interface com.tangosol.net.partition.KeyPartitioningStrategy | 
|---|
| KeyPartitioningStrategy.PartitionAwareKey | 
| Field Summary | |
|---|---|
| protected  PartitionedService | m_serviceThe PartitionedService that this strategy is bound to. | 
| Constructor Summary | |
|---|---|
| DefaultKeyPartitioningStrategy()Default constructor. | |
| Method Summary | |
|---|---|
| static int | calculateBasePartitionHash(PartitionedService service, java.lang.Object oKey)Determine the partition-hash of the given key. | 
| static int | calculateKeyPartition(PartitionedService service, java.lang.Object oKey)Determine the partition to which the given key should be assigned for the specified PartitionService, taking into consideration the associations provided by the service's KeyAssociator. | 
| static int | calculateKeyPartitionHash(PartitionedService service, java.lang.Object oKey)Determine the partition-hash of the given key. | 
| static int | calculatePartition(PartitionedService service, int nHash)Return the partition associated with the specified hash value in the specified PartitionedService. | 
|  PartitionSet | getAssociatedPartitions(java.lang.Object oKey)Determine the set of partitions that all keys associated with the specified key are assigned to. | 
|  int | getKeyPartition(java.lang.Object oKey)Determine the partition to which a particular key should be assigned. | 
|  void | init(PartitionedService service)Initialize the KeyPartitioningStrategy and bind it to the specified PartitionedService. | 
| Methods inherited from class com.tangosol.util.BitHelper | 
|---|
| countBits, countBits, countBits, indexOfLSB, indexOfLSB, indexOfLSB, indexOfMSB, indexOfMSB, indexOfMSB, rotateLeft, rotateLeft, rotateLeft, rotateRight, rotateRight, rotateRight, toBitString, toBitString, toBitString, toBytes, toBytes, toBytes, toBytes, toInt, toInt, toLong, toLong | 
| Field Detail | 
|---|
protected PartitionedService m_service
| Constructor Detail | 
|---|
public DefaultKeyPartitioningStrategy()
| Method Detail | 
|---|
public void init(PartitionedService service)
init in interface KeyPartitioningStrategyservice - the PartitionedService that this strategy is being bound topublic int getKeyPartition(java.lang.Object oKey)
In general, implementations are expected to respect the associations provided by the service's KeyAssociator in such a way that keys that return the same associated key would be assigned to the same partition. Furthermore, implementations are also expected to respect explicit partition-assignments dictated by the KeyPartitioningStrategy.PartitionAwareKey interface. Naturally, those two interfaces should not be combined for a given key.
The resulting partition must be in the range [0..N-1], where N is the value returned from PartitionedService.getPartitionCount().
getKeyPartition in interface KeyPartitioningStrategyoKey - a key in its Object formPartitionedService.getPartitionOwner(int)public PartitionSet getAssociatedPartitions(java.lang.Object oKey)
getKeyPartition method.getAssociatedPartitions in interface KeyPartitioningStrategyoKey - a key in its Object form
public static int calculateKeyPartition(PartitionedService service,
                                        java.lang.Object oKey)
The resulting partition will be in the range [0..N), where N is the value returned from the PartitionedService.getPartitionCount() method.
service - the PartitionedServiceoKey - a key in its original (Object) format
public static int calculateKeyPartitionHash(PartitionedService service,
                                            java.lang.Object oKey)
service - the PartitionedServiceoKey - a key in its original (Object) format
public static int calculateBasePartitionHash(PartitionedService service,
                                             java.lang.Object oKey)
service - the PartitionedServiceoKey - a key in its original (Object) format
public static int calculatePartition(PartitionedService service,
                                     int nHash)
service - the PartitionedServicenHash - the hash value| 
 | Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||