com.hazelcast.spi

## Class PartitionMigrationEvent

- java.lang.Object
- - java.util.EventObject
  - - com.hazelcast.spi.PartitionMigrationEvent

- All Implemented Interfaces:
    Serializable

      public class PartitionMigrationEvent
      extends EventObject

  An `EventObject` for a partition migration. Can be used by SPI services to get a callback to listen to partition migration. See `MigrationAwareService` for more info.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class java.util.EventObject

      `source`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PartitionMigrationEvent(MigrationEndpoint migrationEndpoint, int partitionId, int currentReplicaIndex, int newReplicaIndex)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `int` | `getCurrentReplicaIndex()` Gets the index of the partition replica that current member owns currently, before migration starts.
    `MigrationEndpoint` | `getMigrationEndpoint()` Gets the partition migration endpoint.
    `int` | `getNewReplicaIndex()` Gets the index of the partition replica that current member will own after migration is committed.
    `int` | `getPartitionId()` Gets the partition ID.
    `int` | `hashCode()`
    `String` | `toString()`

    - ### Methods inherited from class java.util.EventObject

      `getSource`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PartitionMigrationEvent

          public PartitionMigrationEvent(MigrationEndpoint migrationEndpoint,
                                         int partitionId,
                                         int currentReplicaIndex,
                                         int newReplicaIndex)

  - ### Method Detail

    - #### getMigrationEndpoint

          public MigrationEndpoint getMigrationEndpoint()

      Gets the partition migration endpoint.
      Returns:
        the partition migration endpoint

    - #### getPartitionId

          public int getPartitionId()

      Gets the partition ID.
      Returns:
        the partition ID

    - #### getCurrentReplicaIndex

          public int getCurrentReplicaIndex()

      Gets the index of the partition replica that current member owns currently, before migration starts. This index will be in range of [0,6] if current member owns a replica of the partition. Otherwise it will be -1.
      Returns:
        index of the partition replica that current member owns currently

    - #### getNewReplicaIndex

          public int getNewReplicaIndex()

      Gets the index of the partition replica that current member will own after migration is committed. This index will be -1 if partition replica will be moved from current member completely.
      Returns:
        index of the partition replica that current member will own after migration is committed

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `EventObject`

Copyright © 2019. All rights reserved.