public interface IPartitionService extends CoreService
Modifier and Type | Field and Description |
---|---|
static String |
SERVICE_NAME
The name of the service.
|
Modifier and Type | Method and Description |
---|---|
String |
addLocalPartitionLostListener(PartitionLostListener partitionLostListener) |
String |
addMigrationListener(MigrationListener migrationListener) |
String |
addPartitionLostListener(PartitionLostListener partitionLostListener) |
int |
getMaxAllowedBackupCount()
Returns maximum allowed backup count according to current
cluster formation and partition group configuration.
|
List<Integer> |
getMemberPartitions(Address target)
Returns partition ID list assigned to given target.
|
Map<Address,List<Integer>> |
getMemberPartitionsMap()
Gets member partition IDs.
|
long |
getMigrationQueueSize() |
IPartition |
getPartition(int partitionId)
Returns the
IPartition for a given partition ID. |
IPartition |
getPartition(int partitionId,
boolean triggerOwnerAssignment)
Returns the
IPartition for a given partition ID. |
int |
getPartitionCount()
Returns the number of partitions.
|
int |
getPartitionId(Data key)
Returns the partition ID for a
Data key. |
int |
getPartitionId(Object key)
Returns the partition ID for a given object.
|
Address |
getPartitionOwner(int partitionId)
Gets the owner of the partition if it's set.
|
Address |
getPartitionOwnerOrWait(int partitionId)
Gets the owner of the partition.
|
IPartition[] |
getPartitions()
Returns an array of
IPartition instances. |
int |
getPartitionStateVersion() |
boolean |
hasOnGoingMigration()
Checks if there are any cluster-wide migrations.
|
boolean |
hasOnGoingMigrationLocal()
Checks if there are any local migrations.
|
boolean |
isMemberStateSafe()
Queries and returns if this member in a safe state or not.
|
boolean |
isPartitionOwner(int partitionId)
Check if this node is the owner of a partition.
|
boolean |
removeMigrationListener(String registrationId) |
boolean |
removePartitionLostListener(String registrationId) |
static final String SERVICE_NAME
Address getPartitionOwner(int partitionId)
If the owner of the partition is not set yet, it will trigger partition assignment.
partitionId
- the partitionIdnull
if it's not set yetAddress getPartitionOwnerOrWait(int partitionId)
If none is set, it will wait till the owner is set.
partitionId
- the partitionIdInterruptedException
NoDataMemberInClusterException
- if all nodes are lite members and partitions can't be assignedIPartition getPartition(int partitionId)
IPartition
for a given partition ID.
If the owner of the partition is not set yet, it will trigger partition assignment.
The IPartition
for a given partition ID will never change, so the result can be cached safely.
partitionId
- the partition IDIPartition getPartition(int partitionId, boolean triggerOwnerAssignment)
IPartition
for a given partition ID.
If the owner of the partition is not set yet and triggerOwnerAssignment
is true
,
it will trigger partition assignment.
The IPartition
for a given partition ID will never change, so the result can be cached safely.
partitionId
- the partition IDtriggerOwnerAssignment
- flag to trigger the partition assignmentint getPartitionId(Data key)
Data
key.key
- the Data
keyNullPointerException
- if key is null
int getPartitionId(Object key)
key
- the object keyint getPartitionCount()
List<Integer> getMemberPartitions(Address target)
If the owner of the partition is not set yet, it will trigger partition assignment.
Map<Address,List<Integer>> getMemberPartitionsMap()
Blocks until partitions are assigned.
String addMigrationListener(MigrationListener migrationListener)
boolean removeMigrationListener(String registrationId)
String addPartitionLostListener(PartitionLostListener partitionLostListener)
String addLocalPartitionLostListener(PartitionLostListener partitionLostListener)
boolean removePartitionLostListener(String registrationId)
long getMigrationQueueSize()
boolean isMemberStateSafe()
This method just checks for a safe state, it doesn't force this member to be in a safe state.
true
if this member in a safe state, otherwise false
int getMaxAllowedBackupCount()
The returned number will be in the range of [0, IPartition.MAX_BACKUP_COUNT
].
int getPartitionStateVersion()
boolean hasOnGoingMigration()
true
if there are migrations, false
otherwise.boolean hasOnGoingMigrationLocal()
true
if there are migrations, false
otherwise.boolean isPartitionOwner(int partitionId)
partitionId
- the partition IDtrue
if the node owns the partition,
false
if the node doesn't own the partition or if the partition hasn't been assigned yetIPartition[] getPartitions()
IPartition
instances.
Note: Creates a new array on each invocation, not recommended to use in high-loaded parts of code.
IPartition
instancesCopyright © 2021 Hazelcast, Inc.. All Rights Reserved.