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 |
getOwnerMigrationsInFlight()
Get the number of currently executing migrations.
|
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.
|
public DelegatingMigrationAwareService(MigrationAwareService migrationAwareService)
public Operation prepareReplicationOperation(PartitionReplicationEvent event)
MigrationAwareService
This 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 MigrationAwareService
event
- replicationpublic void beforeMigration(PartitionMigrationEvent event)
MigrationAwareService
Service 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 MigrationAwareService
event
- migration eventpublic void commitMigration(PartitionMigrationEvent event)
MigrationAwareService
Commit is not expected to fail at this point, all exceptions will be suppressed and logged.
commitMigration
in interface MigrationAwareService
event
- migration eventpublic void rollbackMigration(PartitionMigrationEvent event)
MigrationAwareService
Rollback is not expected to fail at this point, all exceptions will be suppressed and logged.
rollbackMigration
in interface MigrationAwareService
event
- migration eventpublic int getOwnerMigrationsInFlight()
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.