blob: 0a26d755e261fd362a51b7fd324f158c4343356d [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.internal.processors.cache.distributed.dht;
import java.util.UUID;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheUpdateTxResult;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
/**
* Abstract future processing transaction enlisting and locking of entries produced with DML and SELECT FOR UPDATE
* queries.
*/
public abstract class GridDhtTxQueryAbstractEnlistFuture extends GridDhtTxAbstractEnlistFuture<Long> {
/** Processed entries count. */
protected long cnt;
/**
* Constructor.
*
* @param nearNodeId Near node ID.
* @param nearLockVer Near lock version.
* @param mvccSnapshot Mvcc snapshot.
* @param threadId Thread ID.
* @param nearFutId Near future id.
* @param nearMiniId Near mini future id.
* @param parts Partitions.
* @param tx Transaction.
* @param timeout Lock acquisition timeout.
* @param cctx Cache context.
*/
protected GridDhtTxQueryAbstractEnlistFuture(UUID nearNodeId,
GridCacheVersion nearLockVer,
MvccSnapshot mvccSnapshot,
long threadId,
IgniteUuid nearFutId,
int nearMiniId,
@Nullable int[] parts,
GridDhtTxLocalAdapter tx,
long timeout,
GridCacheContext<?, ?> cctx) {
super(nearNodeId,
nearLockVer,
mvccSnapshot,
threadId,
nearFutId,
nearMiniId,
null,
tx,
timeout,
cctx, null);
}
/** {@inheritDoc} */
@Override protected Long result0() {
return cnt;
}
/** {@inheritDoc} */
@Override protected void onEntryProcessed(KeyCacheObject key, GridCacheUpdateTxResult res) {
if(res.success())
cnt++;
}
}