Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.net.partition
Interface KeyPartitioningStrategy

All Known Implementing Classes:
  BroadKeyPartitioningStrategy, DefaultKeyPartitioningStrategy

      public interface KeyPartitioningStrategy

A KeyPartitioningStrategy is a pluggable strategy for assigning keys to specific partitions. <p/> Note: as of Coherence 3.6 the contract of the `getKeyPartition` method has changed and should take into consideration the service's `key associator`.

Since:
  Coherence 3.0

Method Summary
`PartitionSet` | `getAssociatedPartitions(Object oKey)` Determine the set of partitions that all keys associated with the specified key are assigned to.
`int` | `getKeyPartition(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.

Method Detail

### init

    void init(PartitionedService service)

  Initialize the KeyPartitioningStrategy and bind it to the specified PartitionedService.
  Parameters:
    `service` - the PartitionedService that this strategy is being bound to

### getKeyPartition

    int getKeyPartition(Object oKey)

  Determine the partition to which a particular key should be assigned. <p/> In general, the 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. <p/> The resulting partition must be in the range `[0..N-1]`, where `N` is the value returned from `PartitionedService.getPartitionCount()`.
  Parameters:
    `oKey` - a key in its Object form
  Returns:
    the partition ID that the specified key is assigned to
  See Also:
    `PartitionAssignmentStrategy.getPartitionOwner(int)`

### getAssociatedPartitions

    PartitionSet getAssociatedPartitions(Object oKey)

  Determine the set of partitions that all keys associated with the specified key are assigned to. Most commonly, this method returns a partition set containing a single partition returned by the `getKeyPartition` method.
  Parameters:
    `oKey` - a key in its Object form
  Returns:
    the PartitionSet associated with the specified key
  Since:
    Coherence 3.6

Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.