public class DelegatingMigrationAwareService extends Object implements MigrationAwareService
MigrationAwareService that delegates to another MigrationAwareService and keeps track of the number of
migrations concerning the partition owner (either as current or new replica index) currently in-flight.| Constructor and Description |
|---|
DelegatingMigrationAwareService(MigrationAwareService migrationAwareService) |
| Modifier and Type | Method and Description |
|---|---|
void |
beforeMigration(PartitionMigrationEvent event)
Called before migration process starts, on both source and destination members.
|
void |
commitMigration(PartitionMigrationEvent event)
Commits the migration process for this service, on both source and destination members.
|
int |
getMigrationStamp()
Returns a stamp to denote current migration state which can later be validated
using
validateMigrationStamp(int). |
Operation |
prepareReplicationOperation(PartitionReplicationEvent event)
Returns an operation to replicate service data and/or state for a specific partition replica
on another cluster member.
|
void |
rollbackMigration(PartitionMigrationEvent event)
Rollback the migration process for this service, on both source and destination members.
|
boolean |
validateMigrationStamp(int stamp)
Returns true if there's no primary replica migrations started and/or completed
since issuance of the given stamp.
|
public DelegatingMigrationAwareService(MigrationAwareService migrationAwareService)
public Operation prepareReplicationOperation(PartitionReplicationEvent event)
MigrationAwareServiceThis method will be called on source member whenever partitioning system requires to copy/replicate a partition replica. Returned operation will be executed on destination member. If operation fails by throwing exception, migration process will fail and will be rolled back.
Returning null is allowed and means service does not have anything to replicate.
prepareReplicationOperation in interface MigrationAwareServiceevent - replicationpublic void beforeMigration(PartitionMigrationEvent event)
MigrationAwareServiceService can take actions required before migration. Migration process will block until this method returns. If this method fails by throwing an exception, migration process for specific partition will fail and will be rolled back.
beforeMigration in interface MigrationAwareServiceevent - migration eventpublic void commitMigration(PartitionMigrationEvent event)
MigrationAwareServiceCommit is not expected to fail at this point, all exceptions will be suppressed and logged.
commitMigration in interface MigrationAwareServiceevent - migration eventpublic void rollbackMigration(PartitionMigrationEvent event)
MigrationAwareServiceRollback is not expected to fail at this point, all exceptions will be suppressed and logged.
rollbackMigration in interface MigrationAwareServiceevent - migration eventpublic int getMigrationStamp()
validateMigrationStamp(int).public boolean validateMigrationStamp(int stamp)
stamp - a stampCopyright © 2017 Hazelcast, Inc.. All Rights Reserved.