O'Reilly logo

Getting Started with Hazelcast - Second Edition by Mat Johns

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Moving data around the place

The final listener is very useful as it lets an application know when Hazelcast is rebalancing the data within the cluster. This gives us an opportunity to prevent or even block the shutdown of a node, as we might be in a period of increased data resilience risk because we may be actively moving data around at the time. The interface used in this case is MigrationListener. It will notify the application when the partitions migrate from one node to another and when they complete:

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required