use of org.apache.ignite.internal.processors.cache.mvcc.msg.MvccActiveQueriesMessage in project ignite by apache.
the class MvccProcessorImpl method processActiveQueries.
/**
*/
private void processActiveQueries(Collection<ClusterNode> nodes, MvccCoordinator newCrd, boolean sndQrys) {
GridLongList qryIds = sndQrys ? new GridLongList(Stream.concat(activeTrackers.values().stream(), ctx.cache().context().tm().activeTransactions().stream().filter(tx -> tx.near() && tx.local())).mapToLong(q -> ((MvccCoordinatorChangeAware) q).onMvccCoordinatorChange(newCrd)).filter(ID_FILTER).toArray()) : new GridLongList();
if (newCrd.local()) {
prevQueries.addActiveQueries(ctx.localNodeId(), qryIds);
prevQueries.init(nodes, ctx.discovery()::alive);
} else if (sndQrys) {
ctx.pools().getSystemExecutorService().submit(() -> {
try {
sendMessage(newCrd.nodeId(), new MvccActiveQueriesMessage(qryIds));
} catch (IgniteCheckedException e) {
U.error(log, "Failed to send active queries to mvcc coordinator: " + e);
}
});
}
}
Aggregations