public class InternalPartitionImpl extends Object implements InternalPartition
MAX_REPLICA_COUNTMAX_BACKUP_COUNT| Constructor and Description |
|---|
InternalPartitionImpl(int partitionId,
PartitionListener listener,
Address thisAddress,
Address[] addresses) |
| 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.
|
int |
getReplicaIndex(Address address)
Return the replica index for this partition.
|
static int |
getReplicaIndex(Address[] addresses,
Address address)
Returns the index of the
address in addresses or -1 if the address is null or
not present. |
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.
|
void |
setMigrating(boolean isMigrating) |
String |
toString() |
public InternalPartitionImpl(int partitionId,
PartitionListener listener,
Address thisAddress,
Address[] addresses)
public int getPartitionId()
IPartitionThe partition ID will be between 0 and partitionCount (exclusive).
getPartitionId in interface IPartitionpublic boolean isMigrating()
IPartitionThe returned value could be stale when it is returned.
isMigrating in interface IPartitiontrue if there is a migration going on, false otherwisepublic void setMigrating(boolean isMigrating)
public boolean isLocal()
IPartitionIPartition.getOwnerOrNull() returns the same address as 'this' address of the
ClusterService.getThisAddress(). If the address is null or a different address, false
is returned.isLocal in interface IPartitiontrue if local, false otherwisepublic Address getOwnerOrNull()
IPartition
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.
getOwnerOrNull in interface IPartitionpublic Address getReplicaAddress(int replicaIndex)
IPartitionThe 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.
getReplicaAddress in interface IPartitionreplicaIndex - the index of the replicapublic boolean isOwnerOrBackup(Address address)
IPartitionisOwnerOrBackup in interface IPartitionaddress - owner addresstrue if address is owner or backup, false otherwisepublic int getReplicaIndex(Address address)
InternalPartitiongetReplicaIndex in interface InternalPartitionaddress - the replica addresspublic static int getReplicaIndex(Address[] addresses, Address address)
address in addresses or -1 if the address is null or
not present.Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.