Cluster Library

Contents

Cluster Library

This library contains cluster related functions.

Usage

Add the following into your build.gradle file:

dependencies {
  include 'com.enonic.xp:lib-cluster:${xpVersion}
}

In your JavaScript controller, add a require statement:

const clusterLib = require('/lib/xp/cluster');

You are now free to use the library functionality.

Functions

isMaster

Tests whether the current node is the master node in the cluster.

Parameters

None

Returns

boolean : true if the current node is master; false otherwise.

Example

Initialize data only on the master node
if (clusterLib.isMaster()) {
    initializeRepo();
}

Contents