Local nodes

To work with the local node, you need to get the local ClusterGroup:

public class LocalNodes {
public static void main(String[] args) {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setPeerClassLoadingEnabled(true);
try (Ignite ignite = Ignition.start(cfg)) {
IgniteCluster cluster = ignite.cluster();

//Get local server group
ClusterGroup forLocal = cluster.forLocal();

//Get a compute task for local servers
IgniteCompute compute = ignite.compute(forLocal);

//broadcast the computation to local nodes
compute.broadcast(() -> {
System.out.println("******** Local Only *********");
});
}
}
}

It prints the message to the local program console only:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.91.47