|
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.BitHelper
com.tangosol.util.ExternalizableHelper
com.tangosol.net.partition.DefaultKeyPartitioningStrategy
com.tangosol.net.partition.BroadKeyPartitioningStrategy
public class BroadKeyPartitioningStrategy
The BroadKeyPartitioningStrategy is a strategy that could be used in cases when the standard key association-based strategy produces very uneven partition distribution - some partitions having significantly larger amount of data than others. Another use case is a partitioned cache with relatively small number of logical groups of values, when using the standard association strategy would result in only a small number of partitions containing any data and large number of partitions being completely empty.
While using the BroadKeyPartitioningStrategy allows to spread data much more evenly across partitions and still have scalable parallel queries (based on the KeyAssociatedFilter
), it comes with a trade-off - associated entries can no longer be assume to reside in the same JVM, though with a relatively high probability they will.
If the semantics of an application allows dynamically determining the desired span for different logically associated groups of entries, it is recommended to extend this strategy and override the getSpan()
method.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.tangosol.net.partition.KeyPartitioningStrategy |
---|
KeyPartitioningStrategy.PartitionAwareKey |
Field Summary |
---|
Fields inherited from class com.tangosol.net.partition.DefaultKeyPartitioningStrategy |
---|
m_service |
Constructor Summary | |
---|---|
BroadKeyPartitioningStrategy(int nSpan) Construct the BroadKeyPartitioningStrategy based on the specified span. |
Method Summary | |
---|---|
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. |
protected int |
getSpan(java.lang.Object oBaseKey) Calculate the partition span for a logical group of keys represented by the specified "base" key. |
void |
init(PartitionedService service) Initialize the KeyPartitioningStrategy and bind it to the specified PartitionedService. |
Methods inherited from class com.tangosol.net.partition.DefaultKeyPartitioningStrategy |
---|
calculateBasePartitionHash, calculateKeyPartition, calculateKeyPartitionHash, calculatePartition |
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 |
Constructor Detail |
---|
public BroadKeyPartitioningStrategy(int nSpan)
nSpan
- the default span valueMethod Detail |
---|
public void init(PartitionedService service)
init
in interface KeyPartitioningStrategy
init
in class DefaultKeyPartitioningStrategy
service
- 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 KeyPartitioningStrategy
getKeyPartition
in class DefaultKeyPartitioningStrategy
oKey
- a key in its Object formPartitionedService.getPartitionOwner(int)
public PartitionSet getAssociatedPartitions(java.lang.Object oKey)
getKeyPartition
method.getAssociatedPartitions
in interface KeyPartitioningStrategy
getAssociatedPartitions
in class DefaultKeyPartitioningStrategy
oKey
- a key in its Object formprotected int getSpan(java.lang.Object oBaseKey)
KeyAssociator
.
The default implementation just returns the constant span value, but subclasses could implement this method based on additional application level semantics or construction-time configuration to dynamically assign greater span values to larger logical groups.
oBaseKey
- the "base" key in Object format
|
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 |