com.hazelcast.core

## Class MigrationEvent

- java.lang.Object
- - com.hazelcast.core.MigrationEvent

- All Implemented Interfaces:
    DataSerializable, PartitionEvent

      public class MigrationEvent
      extends Object
      implements DataSerializable, PartitionEvent

  An event fired when a partition migration starts, completes or fails.
  See Also:
    `Partition`, `PartitionService`, `MigrationListener`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `MigrationEvent.MigrationStatus` Migration status: Started, completed or failed

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MigrationEvent()`
    `MigrationEvent(int partitionId, Member oldOwner, Member newOwner, MigrationEvent.MigrationStatus status)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Member` | `getNewOwner()` Returns the new owner of the migrating partition
    `Member` | `getOldOwner()` Returns the old owner of the migrating partition
    `int` | `getPartitionId()` Returns the ID of the partition which is (or is being) migrated
    `MigrationEvent.MigrationStatus` | `getStatus()` Returns the status of the migration: started, completed or failed
    `void` | `readData(ObjectDataInput in)` Reads fields from the input stream
    `String` | `toString()`
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

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

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

- - ### Constructor Detail

    - #### MigrationEvent

          public MigrationEvent()

    - #### MigrationEvent

          public MigrationEvent(int partitionId,
                                Member oldOwner,
                                Member newOwner,
                                MigrationEvent.MigrationStatus status)

  - ### Method Detail

    - #### getPartitionId

          public int getPartitionId()

      Returns the ID of the partition which is (or is being) migrated
      Specified by:
        `getPartitionId` in interface `PartitionEvent`
      Returns:
        the ID of the partition which is (or is being) migrated

    - #### getOldOwner

          public Member getOldOwner()

      Returns the old owner of the migrating partition
      Returns:
        the old owner of the migrating partition

    - #### getNewOwner

          public Member getNewOwner()

      Returns the new owner of the migrating partition
      Returns:
        the new owner of the migrating partition

    - #### getStatus

          public MigrationEvent.MigrationStatus getStatus()

      Returns the status of the migration: started, completed or failed
      Returns:
        the migration status: started, completed or failed

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

    - #### readData

          public void readData(ObjectDataInput in)
                        throws IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the input stream has been closed.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2019. All rights reserved.