public class InternalPartitionServiceImpl extends Object implements InternalPartitionService, ManagedService, EventPublishingService<PartitionEvent,PartitionEventListener<PartitionEvent>>, PartitionAwareService
InternalPartitionService implementation.DEFAULT_REPLICA_SYNC_DELAY, MIGRATION_EVENT_TOPIC, MIGRATION_RETRY_COUNT, MIGRATION_RETRY_PAUSE, PARTITION_LOST_EVENT_TOPIC, REPLICA_SYNC_RETRY_DELAYSERVICE_NAME| Constructor and Description |
|---|
InternalPartitionServiceImpl(Node node) |
public InternalPartitionServiceImpl(Node node)
public void init(NodeEngine nodeEngine, Properties properties)
ManagedServiceinit in interface ManagedServicenodeEngine - the NodeEngine that this ManagedService belongs to.properties - the Properties. Can be used to pass settings to the service.public Address getPartitionOwner(int partitionId)
IPartitionServicegetPartitionOwner in interface IPartitionServicepartitionId - the partitionIdpublic Address getPartitionOwnerOrWait(int partitionId)
IPartitionServicegetPartitionOwnerOrWait in interface IPartitionServicepartitionId - the partitionIdpublic void firstArrangement()
firstArrangement in interface InternalPartitionServicepublic void setInitialState(Address[][] newState, int partitionStateVersion)
public int getMemberGroupsSize()
getMemberGroupsSize in interface InternalPartitionServicepublic int getMaxAllowedBackupCount()
IPartitionServiceIPartition.MAX_BACKUP_COUNT].getMaxAllowedBackupCount in interface IPartitionServicepublic boolean isMemberAllowedToJoin(Address address)
isMemberAllowedToJoin in interface InternalPartitionServicepublic void memberAdded(MemberImpl member)
memberAdded in interface InternalPartitionServicepublic void memberRemoved(MemberImpl member)
memberRemoved in interface InternalPartitionServicepublic void cancelReplicaSyncRequestsTo(Address deadAddress)
public PartitionRuntimeState createPartitionState()
createPartitionState in interface InternalPartitionServicepublic PartitionRuntimeState createPartitionStateInternal()
public boolean processPartitionRuntimeState(PartitionRuntimeState partitionState)
public IPartition[] getPartitions()
getPartitions in interface IPartitionServicepublic InternalPartition[] getInternalPartitions()
getInternalPartitions in interface InternalPartitionServicepublic InternalPartition getPartition(int partitionId)
IPartitionServicegetPartition in interface InternalPartitionServicegetPartition in interface IPartitionServicepartitionId - the partitionIdpublic InternalPartition getPartition(int partitionId, boolean triggerOwnerAssignment)
IPartitionServicetriggerOwnerAssignment is true,
it will trigger partition assignment.
The IPartition for a given partitionId will never change, so it can be cached safely.getPartition in interface InternalPartitionServicegetPartition in interface IPartitionServicepartitionId - the partitionIdtriggerOwnerAssignment - flag to trigger partition assignmentpublic boolean prepareToSafeShutdown(long timeout,
TimeUnit unit)
prepareToSafeShutdown in interface InternalPartitionServicepublic void onShutdownRequest(Address address)
public void onShutdownResponse()
public boolean isMemberStateSafe()
IPartitionServiceisMemberStateSafe in interface IPartitionServicetrue if this member in a safe state, otherwise falsepublic boolean hasOnGoingMigration()
IPartitionServicehasOnGoingMigration in interface IPartitionServicepublic boolean hasOnGoingMigrationLocal()
IPartitionServicehasOnGoingMigrationLocal in interface IPartitionServicepublic final int getPartitionId(Data key)
IPartitionServicegetPartitionId in interface IPartitionServicekey - the Data key.public final int getPartitionId(Object key)
IPartitionServicegetPartitionId in interface IPartitionServicekey - the object key.public final int getPartitionCount()
IPartitionServicegetPartitionCount in interface IPartitionServicepublic long getPartitionMigrationTimeout()
public long[] incrementPartitionReplicaVersions(int partitionId,
int backupCount)
incrementPartitionReplicaVersions in interface InternalPartitionServicepublic void updatePartitionReplicaVersions(int partitionId,
long[] versions,
int replicaIndex)
updatePartitionReplicaVersions in interface InternalPartitionServicepublic boolean isPartitionReplicaVersionStale(int partitionId,
long[] versions,
int replicaIndex)
isPartitionReplicaVersionStale in interface InternalPartitionServicepublic long[] getPartitionReplicaVersions(int partitionId)
getPartitionReplicaVersions in interface InternalPartitionServicepublic Map<Address,List<Integer>> getMemberPartitionsMap()
IPartitionServicegetMemberPartitionsMap in interface IPartitionServicepublic List<Integer> getMemberPartitions(Address target)
getMemberPartitions in interface IPartitionServicepublic void reset()
ManagedServicereset in interface ManagedServicepublic void pauseMigration()
pauseMigration in interface InternalPartitionServicepublic void resumeMigration()
resumeMigration in interface InternalPartitionServicepublic boolean isReplicaSyncAllowed()
public void shutdown(boolean terminate)
ManagedServiceshutdown in interface ManagedServiceterminate - true to shut down the ManagedServicepublic long getMigrationQueueSize()
getMigrationQueueSize in interface IPartitionServicepublic PartitionServiceProxy getPartitionServiceProxy()
public String addMigrationListener(MigrationListener listener)
addMigrationListener in interface IPartitionServicepublic boolean removeMigrationListener(String registrationId)
removeMigrationListener in interface IPartitionServicepublic String addPartitionLostListener(PartitionLostListener listener)
addPartitionLostListener in interface IPartitionServicepublic String addLocalPartitionLostListener(PartitionLostListener listener)
addLocalPartitionLostListener in interface IPartitionServicepublic boolean removePartitionLostListener(String registrationId)
removePartitionLostListener in interface IPartitionServicepublic void dispatchEvent(PartitionEvent partitionEvent, PartitionEventListener partitionEventListener)
dispatchEvent in interface EventPublishingService<PartitionEvent,PartitionEventListener<PartitionEvent>>public void addPartitionListener(PartitionListener listener)
public boolean isPartitionOwner(int partitionId)
IPartitionServiceisPartitionOwner in interface IPartitionServicepublic int getPartitionStateVersion()
getPartitionStateVersion in interface IPartitionServicepublic void onPartitionLost(IPartitionLostEvent event)
PartitionAwareServiceonPartitionLost in interface PartitionAwareServiceevent - The event object that contains the partition id and the number of replicas that is lostpublic void setInternalMigrationListener(InternalMigrationListener listener)
public InternalMigrationListener getInternalMigrationListener()
public void resetInternalMigrationListener()
public List<ReplicaSyncInfo> getOngoingReplicaSyncRequests()
public List<ScheduledEntry<Integer,ReplicaSyncInfo>> getScheduledReplicaSyncRequests()
public PartitionStateManager getPartitionStateManager()
public MigrationManager getMigrationManager()
public PartitionReplicaManager getReplicaManager()
public PartitionReplicaStateChecker getPartitionReplicaStateChecker()
public PartitionEventManager getPartitionEventManager()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.