Reader small image

You're reading from  Getting Started with Hazelcast

Product typeBook
Published inAug 2013
Reading LevelBeginner
Publisher
ISBN-139781782167303
Edition1st Edition
Languages
Right arrow
Author (1)
Matthew Johns
Matthew Johns
author image
Matthew Johns

contacted on 6 may '16 ________ Matthew Johns is an agile software engineer and hands-on technical/solution architect; specialising in designing and delivering highly scaled and available distributed systems, with broad experience across the whole stack. He is the solution architect and lead engineer at Sky.
Read more about Matthew Johns

Right arrow

Moving data around the place


The final listener is very useful as it lets our application know when Hazelcast is rebalancing the data within the cluster. This allows us the opportunity to prevent or even block the shutdown of a node as we might be in a period of increased data resilience risk. The interface used for this case is MigrationListener and will notify our application as partitions are migrated from one node to another and when they have completed.

public class ClusterMigrationListener implements MigrationListener {

  @Override
  public void migrationStarted(MigrationEvent migrationEvent) {
    System.err.println("Started: " + migrationEvent);
  }

  @Override
  public void migrationCompleted(MigrationEvent migrationEvent) {
    System.err.println("Completed: " + migrationEvent);
  }

  @Override
  public void migrationFailed(MigrationEvent migrationEvent) {
    System.err.println("Failed: " + migrationEvent);
  }
}

In registering this cluster listener in our example application...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Getting Started with Hazelcast
Published in: Aug 2013Publisher: ISBN-13: 9781782167303

Author (1)

author image
Matthew Johns

contacted on 6 may '16 ________ Matthew Johns is an agile software engineer and hands-on technical/solution architect; specialising in designing and delivering highly scaled and available distributed systems, with broad experience across the whole stack. He is the solution architect and lead engineer at Sky.
Read more about Matthew Johns