use of org.apache.ignite.internal.cluster.ClusterGroupAdapter in project ignite by apache.
the class GridClusterStateProcessor method sendComputeCheckGlobalState.
/**
* Check cluster state.
*
* @return Cluster state, {@code True} if cluster active, {@code False} if inactive.
*/
private boolean sendComputeCheckGlobalState() {
AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
if (log.isInfoEnabled()) {
log.info("Sending check cluster state request from node [id=" + ctx.localNodeId() + ", topVer=" + topVer + ", client=" + ctx.clientNode() + ", daemon" + ctx.isDaemon() + "]");
}
IgniteCompute comp = ((ClusterGroupAdapter) ctx.cluster().get().forServers()).compute();
return comp.call(new IgniteCallable<Boolean>() {
@IgniteInstanceResource
private Ignite ig;
@Override
public Boolean call() throws Exception {
return ig.active();
}
});
}
use of org.apache.ignite.internal.cluster.ClusterGroupAdapter in project ignite by apache.
the class GridClusterStateProcessor method sendComputeChangeGlobalState.
/**
* @param activate New cluster state.
* @param resFut State change future.
*/
private void sendComputeChangeGlobalState(boolean activate, BaselineTopology blt, boolean forceBlt, final GridFutureAdapter<Void> resFut) {
AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
if (log.isInfoEnabled()) {
log.info("Sending " + prettyStr(activate) + " request from node [id=" + ctx.localNodeId() + ", topVer=" + topVer + ", client=" + ctx.clientNode() + ", daemon=" + ctx.isDaemon() + "]");
}
IgniteCompute comp = ((ClusterGroupAdapter) ctx.cluster().get().forServers()).compute();
IgniteFuture<Void> fut = comp.runAsync(new ClientChangeGlobalStateComputeRequest(activate, blt, forceBlt));
fut.listen(new CI1<IgniteFuture>() {
@Override
public void apply(IgniteFuture fut) {
try {
fut.get();
resFut.onDone();
} catch (Exception e) {
resFut.onDone(e);
}
}
});
}
Aggregations