Interface PartitionedService

All Superinterfaces:
ClassLoaderAware, Controllable, Service, Service
All Known Subinterfaces:
DistributedCacheService, PagedTopicService

public interface PartitionedService extends Service
A PartitionedService is aware of a mapping of keys to partitions and of partitions to cluster members.
Since:
Coherence 3.0
  • Method Details

    • getPartitionCount

      int getPartitionCount()
      Determine the number of partitions that the service has been configured to "break up" the conceptual "key set" into.

      The value of this property is in the range [1..n] where n is an arbitrarily large integer value that does not exceed Integer.MAX_VALUE.

      Returns:
      the number of separate partitions into which this service partitions the set of potential keys
    • getBackupCount

      int getBackupCount()
      Determine the configured redundancy count that this service has been configured to maintain. A redundancy count of zero implies that the service will not maintain backup copies of information for failover purposes, while a redundancy count greater than zero indicates that the service must attempt to synchronously maintain that number of backup copies of the data under the management of the service in order to provide seamless (and lossless) failover of data and processing.

      The value of this property is in the range [0..n] where n is an arbitrarily large integer value that does not exceed Integer.MAX_VALUE.

      Returns:
      the configured redundancy count for this service
    • getKeyAssociator

      KeyAssociator getKeyAssociator()
      Determine the key associator that this service has been configured to use. Information provided by this KeyAssociator will be used to place all associated keys into the same partition.
      Returns:
      the KeyAssociator for this service
    • getKeyPartitioningStrategy

      KeyPartitioningStrategy getKeyPartitioningStrategy()
      Determine the strategy for key partitioning that this service has been configured to use.
      Returns:
      the KeyPartitioningStrategy for this service
    • getPartitionAssignmentStrategy

      PartitionAssignmentStrategy getPartitionAssignmentStrategy()
      Determine the strategy for assigning partitions to cluster members that this service has been configured to use.
      Returns:
      the PartitionAssignmentStrategy for this service
    • getKeyOwner

      Member getKeyOwner(Object oKey)
      Determine the primary owner of the specified key, as determined by the combination of the KeyPartitioningStrategy and the PartitionAssignmentStrategy. It's possible that during partition re-distribution (e.g. as a result of a failover) this method will return null, indicating that the partition ownership is currently undetermined.
      Parameters:
      oKey - a key in its Object form
      Returns:
      the cluster Member that is currently the owner for the specified key or null if the ownership is currently undetermined
    • getPartitionOwner

      Member getPartitionOwner(int nPartition)
      Determine the primary owner of the specified partition. It is possible that during partition re-distribution (e.g. as a result of a failover) that this method will return null, indicating that the partition ownership is currently undetermined.
      Parameters:
      nPartition - a partition ID
      Returns:
      the cluster Member that is currently the owner for the specified partition or null if the distribution is currently undetermined
      Throws:
      IllegalArgumentException - if the partition number is negative or greater than the partition count for this partitioned service
    • getOwnershipVersion

      int getOwnershipVersion(int nPartition)
      Determine the primary owner's version of the specified partition. It is possible that during partition re-distribution (e.g. as a result of a failover) that this method will return -1, indicating that the partition ownership is currently undetermined.
      Parameters:
      nPartition - a partition ID
      Returns:
      the partition ownership version or -1
      Throws:
      IllegalArgumentException - if the partition number is negative or greater than the partition count for this partitioned service
      Since:
      Coherence 12.2.1.1
    • getBackupOwner

      Member getBackupOwner(int nPartition, int nBackup)
      Determine the backup owner of the specified partition. It is possible that during partition re-distribution (e.g. as a result of a failover) that this method will return null, indicating that the partition ownership is currently undetermined.
      Parameters:
      nPartition - a partition ID
      nBackup - the backup number (one-based)
      Returns:
      the cluster Member that is currently the owner for the specified backup copy for the given partition, or null if the distribution is currently undetermined
      Throws:
      IllegalArgumentException - if the partition number is negative or greater than the partition count or if the backup number is non-positive or greater than the backup count for this partitioned service
    • getOwnedPartitions

      default PartitionSet getOwnedPartitions()
      Determine the PartitionSet that is currently owned by the local cluster Member. If the local member does not run this clustered service, null is returned.

      Note: the returned PartitionSet represents a "snapshot" of the ownership information at a time of the call and may change at any moment.

      Returns:
      the PartitionSet that the local cluster Member currently owns
      Since:
      23.09
    • getOwnedPartitions

      PartitionSet getOwnedPartitions(Member member)
      Determine the PartitionSet that is currently owned by a cluster Member. If the specified member does not run this clustered service, null is returned.

      Note: the returned PartitionSet represents a "snapshot" of the ownership information at a time of the call and may change at any moment.

      Parameters:
      member - the cluster Member
      Returns:
      the PartitionSet that the cluster Member currently owns
      Since:
      Coherence 3.4
    • getOwnershipEnabledMembers

      Set<Member> getOwnershipEnabledMembers()
      Return a Set of Member objects, one for each Member that has registered this PartitionedService and is partition ownership-enabled.
      Returns:
      a set of Member objects that provide partition ownership for this partitioned service
      Since:
      Coherence 3.6
    • getOwnershipSenior

      Member getOwnershipSenior()
      Return the senior ownership-enabled member in the service.
      Returns:
      the senior ownership-enabled member in the service
      Since:
      Coherence 12.2.1
    • addPartitionListener

      void addPartitionListener(PartitionListener listener)
      Add a PartitionListener to this service.
      Parameters:
      listener - the listener to add
      Since:
      Coherence 3.7
    • removePartitionListener

      void removePartitionListener(PartitionListener listener)
      Remove a PartitionListener from this service.
      Parameters:
      listener - the listener to remove
      Since:
      Coherence 3.7
    • getBackupStrength

      int getBackupStrength()
      Return the current backup strength of the partitioned service.
      Returns:
      the current backup strength of the partitioned service
    • getBackupStrengthName

      String getBackupStrengthName()
      Return the string representing current backup strength.
      Returns:
      the string representing current backup strength
    • getPersistenceMode

      String getPersistenceMode()
      Return the persistence mode, or null if persistence is not configured.
      Returns:
      the persistence mode, or null if persistence is not configured