Search in sources :

Example 1 with MvccActiveQueriesMessage

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);
            }
        });
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) GridLongList(org.apache.ignite.internal.util.GridLongList) MvccActiveQueriesMessage(org.apache.ignite.internal.processors.cache.mvcc.msg.MvccActiveQueriesMessage)

Aggregations

IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 MvccActiveQueriesMessage (org.apache.ignite.internal.processors.cache.mvcc.msg.MvccActiveQueriesMessage)1 GridLongList (org.apache.ignite.internal.util.GridLongList)1