| /* |
| * 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.Collection; |
| import java.util.Iterator; |
| import java.util.UUID; |
| import org.apache.ignite.IgniteCheckedException; |
| import org.apache.ignite.internal.processors.cache.GridCacheContext; |
| import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot; |
| import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; |
| import org.apache.ignite.internal.processors.query.EnlistOperation; |
| import org.apache.ignite.internal.processors.query.UpdateSourceIterator; |
| import org.apache.ignite.internal.util.typedef.internal.S; |
| import org.apache.ignite.lang.IgniteUuid; |
| |
| /** |
| * Future processing transaction enlisting and locking of entries |
| * produces by complex DML queries with reduce step. |
| */ |
| public final class GridDhtTxQueryResultsEnlistFuture extends GridDhtTxQueryAbstractEnlistFuture implements UpdateSourceIterator<Object> { |
| /** Enlist operation. */ |
| private EnlistOperation op; |
| |
| /** Source iterator. */ |
| private Iterator<Object> it; |
| |
| /** |
| * @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 tx Transaction. |
| * @param timeout Lock acquisition timeout. |
| * @param cctx Cache context. |
| * @param rows Collection of rows. |
| * @param op Operation. |
| */ |
| public GridDhtTxQueryResultsEnlistFuture(UUID nearNodeId, |
| GridCacheVersion nearLockVer, |
| MvccSnapshot mvccSnapshot, |
| long threadId, |
| IgniteUuid nearFutId, |
| int nearMiniId, |
| GridDhtTxLocalAdapter tx, |
| long timeout, |
| GridCacheContext<?, ?> cctx, |
| Collection<Object> rows, |
| EnlistOperation op) { |
| super(nearNodeId, |
| nearLockVer, |
| mvccSnapshot, |
| threadId, |
| nearFutId, |
| nearMiniId, |
| null, |
| tx, |
| timeout, |
| cctx); |
| |
| this.op = op; |
| |
| it = rows.iterator(); |
| |
| skipNearNodeUpdates = true; |
| } |
| |
| /** {@inheritDoc} */ |
| @Override protected UpdateSourceIterator<?> createIterator() throws IgniteCheckedException { |
| return this; |
| } |
| |
| /** {@inheritDoc} */ |
| @Override public EnlistOperation operation() { |
| return op; |
| } |
| |
| /** {@inheritDoc} */ |
| @Override public boolean hasNextX() { |
| return it.hasNext(); |
| } |
| |
| /** {@inheritDoc} */ |
| @Override public Object nextX() { |
| return it.next(); |
| } |
| |
| /** {@inheritDoc} */ |
| @Override public String toString() { |
| return S.toString(GridDhtTxQueryResultsEnlistFuture.class, this); |
| } |
| } |