Package com.tangosol.net
Interface PartitionedService
- All Superinterfaces:
ClassLoaderAware
,Controllable
,Service
,Service
- All Known Subinterfaces:
DistributedCacheService
,PagedTopicService
A PartitionedService is aware of a mapping of keys to partitions and of
partitions to cluster members.
- Since:
- Coherence 3.0
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
PartitionedAction represents a type of action taken by a PartitionedService.static class
A PartitionedAction representing the recovery of orphaned partitions from the persistent storage, or the assignment of empty partitions if the persistent storage is unavailable or lost.Nested classes/interfaces inherited from interface com.tangosol.net.Service
Service.MemberJoinAction
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPartitionListener
(PartitionListener listener) Add a PartitionListener to this service.int
Determine the configured redundancy count that this service has been configured to maintain.getBackupOwner
(int nPartition, int nBackup) Determine the backup owner of the specified partition.int
Return the current backup strength of the partitioned service.Return the string representing current backup strength.Determine the key associator that this service has been configured to use.getKeyOwner
(Object oKey) Determine the primary owner of the specified key, as determined by the combination of the KeyPartitioningStrategy and the PartitionAssignmentStrategy.Determine the strategy for key partitioning that this service has been configured to use.default PartitionSet
Determine the PartitionSet that is currently owned by the local cluster Member.getOwnedPartitions
(Member member) Determine the PartitionSet that is currently owned by a cluster Member.Return a Set of Member objects, one for each Member that has registered this PartitionedService and is partition ownership-enabled.Return the senior ownership-enabled member in the service.int
getOwnershipVersion
(int nPartition) Determine the primary owner's version of the specified partition.Determine the strategy for assigning partitions to cluster members that this service has been configured to use.int
Determine the number of partitions that the service has been configured to "break up" the conceptual "key set" into.getPartitionOwner
(int nPartition) Determine the primary owner of the specified partition.Return the persistence mode, ornull
if persistence is not configured.void
removePartitionListener
(PartitionListener listener) Remove a PartitionListener from this service.Methods inherited from interface com.tangosol.io.ClassLoaderAware
getContextClassLoader, setContextClassLoader
Methods inherited from interface com.tangosol.util.Controllable
configure, isRunning, shutdown, start, stop
Methods inherited from interface com.tangosol.net.Service
addMemberListener, getCluster, getDependencies, getInfo, getMinimumServiceVersion, getResourceRegistry, getSerializer, getUserContext, isSuspended, isVersionCompatible, isVersionCompatible, isVersionCompatible, isVersionCompatible, removeMemberListener, setDependencies, setUserContext
Methods inherited from interface com.tangosol.util.Service
addServiceListener, removeServiceListener
-
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
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
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 thepartition 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 thepartition count
for this partitioned service- Since:
- Coherence 12.2.1.1
-
getBackupOwner
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 IDnBackup
- 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 thepartition count
or if the backup number is non-positive or greater than thebackup count
for this partitioned service
-
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
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
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
Add a PartitionListener to this service.- Parameters:
listener
- the listener to add- Since:
- Coherence 3.7
-
removePartitionListener
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, ornull
if persistence is not configured.- Returns:
- the persistence mode, or
null
if persistence is not configured
-