public interface IPartition
Partition
but it is optimized for SPI
usage, so it exposes method not meant for regular Hazelcast users.
The IPartition provides access to information about a partition, most importantly the addresses of the replica's and this information will be updated. So one can cache the IPartition and keep asking for partition information.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_BACKUP_COUNT
The maximum number of backups.
|
Modifier and Type | Method and Description |
---|---|
Address |
getOwnerOrNull()
Returns the address of the owner of this partition.
|
int |
getPartitionId()
Returns the partition ID.
|
Address |
getReplicaAddress(int replicaIndex)
Returns the address of the replica.
|
boolean |
isLocal()
Checks if the partition is local.
|
boolean |
isMigrating()
Checks if there currently is a migration going on in this partition.
|
boolean |
isOwnerOrBackup(Address address)
Checks if given address is owner of primary or backup of this partition.
|
static final int MAX_BACKUP_COUNT
boolean isLocal()
getOwnerOrNull()
returns the same address as 'this' address of the
ClusterService.getThisAddress()
. If the address is null
or a different address, false
is returned.true
if local, false
otherwiseint getPartitionId()
The partition ID will be between 0 and partitionCount (exclusive).
Address getOwnerOrNull()
If no owner has been set yet, null is returned. So be careful with assuming that a non null
value is returned.
The value could be stale when returned.
boolean isMigrating()
The returned value could be stale when it is returned.
true
if there is a migration going on, false
otherwiseAddress getReplicaAddress(int replicaIndex)
The owner has replica index 0.
The returned value could be null
if the owner/replica has not yet been set.
The returned value could be stale when it is returned.
replicaIndex
- the index of the replicaArrayIndexOutOfBoundsException
- when replica index is out of boundsboolean isOwnerOrBackup(Address address)
address
- owner addresstrue
if address is owner or backup, false
otherwiseCopyright © 2021 Hazelcast, Inc.. All Rights Reserved.