Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.net
Interface PartitionedService

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

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

Nested Class Summary
static interface PartitionedService.PartitionedAction
          PartitionedAction represents a type of action taken by a PartitionedService.

 

Method Summary
 void addPartitionListener(PartitionListener listener)
          Add a PartitionListener to this service.
 int getBackupCount()
          Determine the configured redundancy count that this service has been configured to maintain.
 Member getBackupOwner(int nPartition, int nBackup)
          Determine the backup owner of the specified partition.
 KeyAssociator getKeyAssociator()
          Determine the key associatior that this service has been configured to use.
 Member getKeyOwner(java.lang.Object oKey)
          Determine the primary owner of the specified key, as determined by the combination of the KeyPartitioningStrategy and the PartitionAssignmentStrategy.
 KeyPartitioningStrategy getKeyPartitioningStrategy()
          Determine the strategy for key partitioning that this service has been configured to use.
 PartitionSet getOwnedPartitions(Member member)
          Determine the PartitionSet that is currently owned by a cluster Member.
 java.util.Set getOwnershipEnabledMembers()
          Return a Set of Member objects, one for each Member that has registered this PartitionedService and is partition ownership-enabled.
 PartitionAssignmentStrategy getPartitionAssignmentStrategy()
          Determine the strategy for assigning partitions to cluster members that this service has been configured to use.
 int getPartitionCount()
          Determine the number of partitions that the service has been configured to "break up" the conceptual "key set" into.
 Member getPartitionOwner(int nPartition)
          Determine the primary owner of the specified partition.
 void removePartitionListener(PartitionListener listener)
          Remove a PartitionListener from this service.

 

Methods inherited from interface com.tangosol.net.Service
addMemberListener, getCluster, getInfo, getSerializer, getUserContext, removeMemberListener, setUserContext

 

Methods inherited from interface com.tangosol.util.Service
addServiceListener, removeServiceListener

 

Methods inherited from interface com.tangosol.util.Controllable
configure, isRunning, shutdown, start, stop

 

Methods inherited from interface com.tangosol.io.ClassLoaderAware
getContextClassLoader, setContextClassLoader

 

Method Detail

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 associatior 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(java.lang.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:
java.lang.IllegalArgumentException - if the partition number is negative or greater than the partition count for this partitioned service

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:
java.lang.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

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

java.util.Set 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

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

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


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