Package com.tangosol.net
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
PartitionedService.PartitionedAction
PartitionedAction represents a type of action taken by a PartitionedService.static class
PartitionedService.PartitionRecoveryAction
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.int
getBackupStrength()
Return the current backup strength of the partitioned service.String
getBackupStrengthName()
Return the string representing current backup strength.KeyAssociator
getKeyAssociator()
Determine the key associator that this service has been configured to use.Member
getKeyOwner(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.Set<Member>
getOwnershipEnabledMembers()
Return a Set of Member objects, one for each Member that has registered this PartitionedService and is partition ownership-enabled.Member
getOwnershipSenior()
Return the senior ownership-enabled member in the service.int
getOwnershipVersion(int nPartition)
Determine the primary owner's version of the specified partition.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.String
getPersistenceMode()
Return the persistence mode, ornull
if persistence is not configured.<V> Converter<V,Binary>
instantiateKeyToBinaryConverter(ClassLoader loader, boolean fPassThrough)
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 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 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
-
instantiateKeyToBinaryConverter
<V> Converter<V,Binary> instantiateKeyToBinaryConverter(ClassLoader loader, boolean fPassThrough)
- Type Parameters:
V
- the type of key to convert- Parameters:
loader
- theClassLoader
to usefPassThrough
- {@link true} if the converter should be a pass-thru binary converter- Returns:
- a
Converter
that can convert a key to aBinary
key
-
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 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
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 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
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, ornull
if persistence is not configured.- Returns:
- the persistence mode, or
null
if persistence is not configured
-
-