use of com.hazelcast.internal.partition.InternalPartition in project hazelcast by hazelcast.
the class InternalPartitionServiceImpl method createPromotionCommitPartitionState.
/**
* Creates a transient PartitionRuntimeState to commit promotions.
* Results of promotions are applied to partition table.
* Version of created partition table is incremented by number of promotions.
*/
PartitionRuntimeState createPromotionCommitPartitionState(Collection<MigrationInfo> migrationInfos) {
lock.lock();
try {
if (!partitionStateManager.isInitialized()) {
return null;
}
List<MigrationInfo> completedMigrations = migrationManager.getCompletedMigrationsCopy();
InternalPartition[] partitions = partitionStateManager.getPartitionsCopy();
for (MigrationInfo migrationInfo : migrationInfos) {
int partitionId = migrationInfo.getPartitionId();
InternalPartitionImpl partition = (InternalPartitionImpl) partitions[partitionId];
migrationManager.applyMigration(partition, migrationInfo);
migrationInfo.setStatus(MigrationStatus.SUCCESS);
}
int committedVersion = getPartitionStateVersion() + migrationInfos.size();
return new PartitionRuntimeState(partitions, completedMigrations, committedVersion);
} finally {
lock.unlock();
}
}
Aggregations