com.hazelcast.spi

## Interface FragmentedMigrationAwareService

- All Superinterfaces:
    MigrationAwareService
  All Known Implementing Classes:
    LockServiceImpl

      public interface FragmentedMigrationAwareService
      extends MigrationAwareService

  `FragmentedMigrationAwareService` is an extension to the `MigrationAwareService` which allows migration/replication of partition replicas in smaller fragments.

  Each replica fragment is distinguished by a `ServiceNamespace`, all replica data belonging to a specific namespace will be transferred in the same packet.

  Both backup and backup aware operations created by `FragmentedMigrationAwareService` must implement `ServiceNamespaceAware` interface and must know their related `ServiceNamespace`s.

  Fragmented migration can be enabled/disabled using configuration property `GroupProperty.PARTITION_FRAGMENTED_MIGRATION_ENABLED`. Anti-entropy system which detects and completes inconsistent backup replicas, always uses fragmented replication for services having support.

  Since:
    3.9
  See Also:
    `MigrationAwareService`, `ServiceNamespace`, `ServiceNamespaceAware`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Collection<ServiceNamespace>` | `getAllServiceNamespaces(PartitionReplicationEvent event)` Returns all known namespaces for given replication event.
    `boolean` | `isKnownServiceNamespace(ServiceNamespace namespace)` Returns true if namespace is known by this service, false otherwise
    `Operation` | `prepareReplicationOperation(PartitionReplicationEvent event, Collection<ServiceNamespace> namespaces)` Returns an operation to replicate service data and/or state for a specific partition replica and namespaces on another cluster member.

    - ### Methods inherited from interface com.hazelcast.spi.MigrationAwareService

      `beforeMigration, commitMigration, prepareReplicationOperation, rollbackMigration`

- - ### Method Detail

    - #### getAllServiceNamespaces

          Collection<ServiceNamespace> getAllServiceNamespaces(PartitionReplicationEvent event)

      Returns all known namespaces for given replication event.
      Parameters:
        `event` - replication event
      Returns:
        all known service namespaces for the replication

    - #### isKnownServiceNamespace

          boolean isKnownServiceNamespace(ServiceNamespace namespace)

      Returns true if namespace is known by this service, false otherwise
      Parameters:
        `namespace` - namespace
      Returns:
        true if namespace is known by this service, false otherwise

    - #### prepareReplicationOperation

          Operation prepareReplicationOperation(PartitionReplicationEvent event,
                                                Collection<ServiceNamespace> namespaces)

      Returns an operation to replicate service data and/or state for a specific partition replica and namespaces on another cluster member. This method is very similar to `MigrationAwareService.prepareReplicationOperation(PartitionReplicationEvent)`, instead of copying whole partition replica, allows copying only some portion of replica, specified by given namespaces.

      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.

      Parameters:
        `event` - replication event
        `namespaces` - replica fragment namespaces to replicate
      Returns:
        replication operation or null if nothing will be replicated
      See Also:
        `MigrationAwareService.prepareReplicationOperation(PartitionReplicationEvent)`

Copyright © 2018. All rights reserved.