com.hazelcast.partition
Interface InternalPartitionService

All Superinterfaces:
CoreService
All Known Implementing Classes:
InternalPartitionServiceImpl

public interface InternalPartitionService
extends CoreService


Field Summary
static long DEFAULT_REPLICA_SYNC_DELAY
           
static long REPLICA_SYNC_RETRY_DELAY
           
static String SERVICE_NAME
           
 
Method Summary
 String addMigrationListener(MigrationListener migrationListener)
           
 void clearPartitionReplicaVersions(int partitionId)
           
 void firstArrangement()
           
 Collection<MigrationInfo> getActiveMigrations()
           
 int getMaxBackupCount()
           
 Member getMember(Address address)
           
 int getMemberGroupsSize()
           
 List<Integer> getMemberPartitions(Address target)
           
 Map<Address,List<Integer>> getMemberPartitionsMap()
          Gets member partition IDs.
 long getMigrationQueueSize()
           
 InternalPartition getPartition(int partitionId)
          Returns the InternalPartition for a given partitionId.
 InternalPartition getPartition(int partitionId, boolean triggerOwnerAssignment)
          Returns the InternalPartition for a given partitionId.
 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.
 long[] getPartitionReplicaVersions(int partitionId)
           
 InternalPartition[] getPartitions()
           
 PartitionService getPartitionServiceProxy()
           
 int getPartitionStateVersion()
           
 boolean hasOnGoingMigration()
          Checks if there currently are any migrations.
 boolean hasOnGoingMigrationLocal()
           
 long[] incrementPartitionReplicaVersions(int partitionId, int totalBackupCount)
           
 boolean isMemberStateSafe()
          Query and return if this member in a safe state or not.
 void memberAdded(MemberImpl newMember)
           
 void memberRemoved(MemberImpl deadMember)
           
 void pauseMigration()
           
 boolean prepareToSafeShutdown(long timeout, TimeUnit seconds)
           
 boolean removeMigrationListener(String registrationId)
           
 void resumeMigration()
           
 void setPartitionReplicaVersions(int partitionId, long[] versions, int replicaOffset)
           
 void updatePartitionReplicaVersions(int partitionId, long[] replicaVersions, int replicaIndex)
           
 

Field Detail

SERVICE_NAME

static final String SERVICE_NAME
See Also:
Constant Field Values

DEFAULT_REPLICA_SYNC_DELAY

static final long DEFAULT_REPLICA_SYNC_DELAY
See Also:
Constant Field Values

REPLICA_SYNC_RETRY_DELAY

static final long REPLICA_SYNC_RETRY_DELAY
See Also:
Constant Field Values
Method Detail

getPartitionOwner

Address getPartitionOwner(int partitionId)
Gets the owner of the partition if it's set. Otherwise it will trigger partition assignment.

Parameters:
partitionId - the partitionId
Returns:
owner of partition or null if it's not set yet.

getPartitionOwnerOrWait

Address getPartitionOwnerOrWait(int partitionId)
                                throws InterruptedException
Gets the owner of the partition. If none is set, it will wait till the owner is set.

Parameters:
partitionId - the partitionId
Returns:
owner of partition
Throws:
InterruptedException

getPartition

InternalPartition getPartition(int partitionId)
Returns the InternalPartition for a given partitionId. If owner of the partition is not set yet, it will trigger partition assignment.

The InternalPartition for a given partitionId wil never change; so it can be cached safely.

Parameters:
partitionId - the partitionId
Returns:
the InternalPartition.

getPartition

InternalPartition getPartition(int partitionId,
                               boolean triggerOwnerAssignment)
Returns the InternalPartition for a given partitionId. If owner of the partition is not set yet and triggerOwnerAssignment is true, it will trigger partition assignment.

The InternalPartition for a given partitionId wil never change; so it can be cached safely.

Parameters:
partitionId - the partitionId
triggerOwnerAssignment - flag to trigger partition assignment
Returns:
the InternalPartition.

getPartitionId

int getPartitionId(Data key)
Returns the partition id for a Data key.

Parameters:
key - the Data key.
Returns:
the partition id.
Throws:
NullPointerException - if key is null.

getPartitionId

int getPartitionId(Object key)
Returns the partition id for a given object.

Parameters:
key - the object key.
Returns:
the partition id.

getPartitionCount

int getPartitionCount()
Returns the number of partitions.

Returns:
the number of partitions.

hasOnGoingMigration

boolean hasOnGoingMigration()
Checks if there currently are any migrations.

Returns:
true if there are migrations, false otherwise.

getMemberPartitions

List<Integer> getMemberPartitions(Address target)

getMemberPartitionsMap

Map<Address,List<Integer>> getMemberPartitionsMap()
Gets member partition IDs. Blocks until partitions are assigned.

Returns:
map of member address to partition Ids

getMemberGroupsSize

int getMemberGroupsSize()

getMaxBackupCount

int getMaxBackupCount()

addMigrationListener

String addMigrationListener(MigrationListener migrationListener)

removeMigrationListener

boolean removeMigrationListener(String registrationId)

getMember

Member getMember(Address address)

getMigrationQueueSize

long getMigrationQueueSize()

pauseMigration

void pauseMigration()

resumeMigration

void resumeMigration()

memberAdded

void memberAdded(MemberImpl newMember)

memberRemoved

void memberRemoved(MemberImpl deadMember)

prepareToSafeShutdown

boolean prepareToSafeShutdown(long timeout,
                              TimeUnit seconds)

isMemberStateSafe

boolean isMemberStateSafe()
Query and return if this member in a safe state or not. This method just checks for a safe state, it doesn't force this member to be in a safe state.

Returns:
true if this member in a safe state, otherwise false

getPartitions

InternalPartition[] getPartitions()

getActiveMigrations

Collection<MigrationInfo> getActiveMigrations()

firstArrangement

void firstArrangement()

getPartitionReplicaVersions

long[] getPartitionReplicaVersions(int partitionId)

updatePartitionReplicaVersions

void updatePartitionReplicaVersions(int partitionId,
                                    long[] replicaVersions,
                                    int replicaIndex)

incrementPartitionReplicaVersions

long[] incrementPartitionReplicaVersions(int partitionId,
                                         int totalBackupCount)

setPartitionReplicaVersions

void setPartitionReplicaVersions(int partitionId,
                                 long[] versions,
                                 int replicaOffset)

clearPartitionReplicaVersions

void clearPartitionReplicaVersions(int partitionId)

getPartitionServiceProxy

PartitionService getPartitionServiceProxy()

getPartitionStateVersion

int getPartitionStateVersion()

hasOnGoingMigrationLocal

boolean hasOnGoingMigrationLocal()


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.