Search in sources :

Example 1 with MvccCoordinator

use of org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator in project ignite by apache.

the class GridNearTxLocal method requestSnapshot.

/**
 * Requests version on coordinator.
 *
 * @return Future to wait for result.
 */
public IgniteInternalFuture<MvccSnapshot> requestSnapshot() {
    if (isRollbackOnly())
        return new GridFinishedFuture<>(rollbackException());
    MvccSnapshot mvccSnapshot0 = mvccSnapshot;
    if (mvccSnapshot0 != null)
        return new GridFinishedFuture<>(mvccSnapshot0);
    MvccProcessor prc = cctx.coordinators();
    MvccCoordinator crd = prc.currentCoordinator();
    synchronized (this) {
        this.crdVer = crd.version();
    }
    if (crd.local())
        mvccSnapshot0 = prc.requestWriteSnapshotLocal();
    if (mvccSnapshot0 == null) {
        MvccSnapshotFuture fut = new MvccTxSnapshotFuture();
        prc.requestWriteSnapshotAsync(crd, fut);
        return fut;
    }
    GridFutureAdapter<MvccSnapshot> fut = new GridFutureAdapter<>();
    onResponse0(mvccSnapshot0, fut);
    return fut;
}
Also used : MvccSnapshot(org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot) MvccCoordinator(org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator) GridFutureAdapter(org.apache.ignite.internal.util.future.GridFutureAdapter) MvccProcessor(org.apache.ignite.internal.processors.cache.mvcc.MvccProcessor) MvccSnapshotFuture(org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshotFuture)

Aggregations

MvccCoordinator (org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator)1 MvccProcessor (org.apache.ignite.internal.processors.cache.mvcc.MvccProcessor)1 MvccSnapshot (org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot)1 MvccSnapshotFuture (org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshotFuture)1 GridFutureAdapter (org.apache.ignite.internal.util.future.GridFutureAdapter)1