With the release of 3.6, Hazelcast introduces two new operations to manage the states of your cluster. These operations can be performed using the new methods changeClusterState()
and shutdown()
which are in the Cluster interface.
By changing the state of your cluster, you can allow/restrict several cluster operations or change the behavior of those operations. Hazelcast clusters have the following states:
ACTIVE
: This is the default cluster state. Cluster continues to operate without restrictions.
FROZEN
: ACTIVE
. When it joins back to the cluster, it will own all previous partition assignments as it was. On the other hand, when the cluster state changes to ACTIVE
, re-partitioning starts and unassigned partitions are assigned to the active members.FROZEN
when migration/replication tasks are being performed.
PASSIVE
:ACTIVE
. map.get()
and cache.get()
, replication and cluster heartbeat tasks. PASSIVE
when migration/replication tasks are being performed.
IN_TRANSITION
: IN_TRANSITION
explicitly. NOTE: All in-cluster methods are fail-fast, i.e. when a method fails in the cluster, it throws an exception immediately (it will not be retried).
The following snippet is from the Cluster
interface showing the new methods used to manage your cluster's states.
public interface Cluster {
...
...
ClusterState getClusterState();
void changeClusterState(ClusterState newState);
void changeClusterState(ClusterState newState, TransactionOptions transactionOptions);
void shutdown();
void shutdown(TransactionOptions transactionOptions);
Please refer to the Cluster interface for information on these methods.