Merge branch 'sprint-2' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-sql-tests
Conflicts: modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/498ea516 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/498ea516 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/498ea516 Branch: refs/heads/ignite-424 Commit: 498ea5164badc913208c5cbd8be59ecf139cc0fc Parents: 260beba cab4716 Author: S.Vladykin <svlady...@gridgain.com> Authored: Tue Mar 17 02:57:04 2015 +0300 Committer: S.Vladykin <svlady...@gridgain.com> Committed: Tue Mar 17 02:57:04 2015 +0300 ---------------------------------------------------------------------- .../org/apache/ignite/cache/CacheImmutable.java | 45 ----- .../ignite/cache/query/SqlFieldsQuery.java | 7 + .../apache/ignite/cache/query/TextQuery.java | 7 + .../configuration/CacheConfiguration.java | 4 +- .../ignite/internal/MarshallerContextImpl.java | 30 ++- .../processors/cache/QueryCursorImpl.java | 14 +- .../processors/cache/query/QueryCursorEx.java | 46 +++++ .../continuous/CacheContinuousQueryHandler.java | 3 + .../cacheobject/IgniteCacheObjectProcessor.java | 3 +- .../IgniteCacheObjectProcessorImpl.java | 4 +- .../org/apache/ignite/lang/IgniteImmutable.java | 49 +++++ .../optimized/OptimizedMarshallerUtils.java | 16 +- .../TcpDiscoveryMulticastIpFinder.java | 4 +- .../GridCacheOnCopyFlagAbstractSelfTest.java | 4 +- .../GridCacheReturnValueTransferSelfTest.java | 3 +- ...acheStoreSessionWriteBehindAbstractTest.java | 16 +- ...ridCacheContinuousQueryAbstractSelfTest.java | 69 ++++++- .../OptimizedMarshallerNodeFailoverTest.java | 200 +++++++++++++++++++ .../IgniteMarshallerSelfTestSuite.java | 1 + .../schema/generator/SnippetGenerator.java | 10 +- 20 files changed, 449 insertions(+), 86 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/498ea516/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/498ea516/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/QueryCursorImpl.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/QueryCursorImpl.java index cc1af78,0000000..2e02c4f mode 100644,000000..100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/QueryCursorImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/QueryCursorImpl.java @@@ -1,87 -1,0 +1,97 @@@ +/* + * 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; + +import org.apache.ignite.*; - import org.apache.ignite.cache.query.*; + +import java.util.*; + +/** + * Query cursor implementation. + */ - public class QueryCursorImpl<T> implements QueryCursor<T> { ++public class QueryCursorImpl<T> implements QueryCursorEx<T> { + /** */ + private Iterator<T> iter; + + /** */ + private boolean iterTaken; + + /** + * @param iter Iterator. + */ + public QueryCursorImpl(Iterator<T> iter) { + this.iter = iter; + } + + /** {@inheritDoc} */ + @Override public Iterator<T> iterator() { + if (iter == null) + throw new IgniteException("Cursor is closed."); + + if (iterTaken) + throw new IgniteException("Iterator is already taken from this cursor."); + + iterTaken = true; + + return iter; + } + + /** {@inheritDoc} */ + @Override public List<T> getAll() { + ArrayList<T> all = new ArrayList<>(); + + try { + for (T t : this) // Implicitly calls iterator() to do all checks. + all.add(t); + } + finally { + close(); + } + + return all; + } + + /** {@inheritDoc} */ ++ @Override public void getAll(QueryCursorEx.Consumer<T> clo) throws IgniteCheckedException { ++ try { ++ for (T t : this) ++ clo.consume(t); ++ } ++ finally { ++ close(); ++ } ++ } ++ ++ /** {@inheritDoc} */ + @Override public void close() { + Iterator<T> i; + + if ((i = iter) != null) { + iter = null; + + if (i instanceof AutoCloseable) { + try { + ((AutoCloseable)i).close(); + } + catch (Exception e) { + throw new IgniteException(e); + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/498ea516/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/498ea516/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/498ea516/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java ---------------------------------------------------------------------- diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java index 0a9c0fc,e0ef254..7203516 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java @@@ -74,19 -77,22 +77,21 @@@ public abstract class GridCacheContinuo cfg.setPeerClassLoadingEnabled(peerClassLoadingEnabled()); - CacheConfiguration cacheCfg = defaultCacheConfiguration(); + if (!gridName.equals(NO_CACHE_GRID_NAME)) { + CacheConfiguration cacheCfg = defaultCacheConfiguration(); - cacheCfg.setCacheMode(cacheMode()); - cacheCfg.setAtomicityMode(atomicityMode()); - cacheCfg.setDistributionMode(distributionMode()); - cacheCfg.setRebalanceMode(ASYNC); - cacheCfg.setWriteSynchronizationMode(FULL_SYNC); - cacheCfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(new TestStore())); - cacheCfg.setReadThrough(true); - cacheCfg.setWriteThrough(true); - cacheCfg.setLoadPreviousValue(true); + cacheCfg.setCacheMode(cacheMode()); + cacheCfg.setAtomicityMode(atomicityMode()); + cacheCfg.setDistributionMode(distributionMode()); + cacheCfg.setRebalanceMode(ASYNC); + cacheCfg.setWriteSynchronizationMode(FULL_SYNC); + cacheCfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(new TestStore())); + cacheCfg.setReadThrough(true); + cacheCfg.setWriteThrough(true); + cacheCfg.setLoadPreviousValue(true); - cacheCfg.setQueryIndexEnabled(false); - cfg.setCacheConfiguration(cacheCfg); + cfg.setCacheConfiguration(cacheCfg); + } TcpDiscoverySpi disco = new TcpDiscoverySpi();