ignite-gg-9933 - review fixes
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/62f93c20 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/62f93c20 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/62f93c20 Branch: refs/heads/ignite-496 Commit: 62f93c20668fa2fa940481ffde968a0a5e05295b Parents: eb335a9 Author: S.Vladykin <svlady...@gridgain.com> Authored: Sat Mar 21 02:16:31 2015 +0300 Committer: S.Vladykin <svlady...@gridgain.com> Committed: Sat Mar 21 02:16:31 2015 +0300 ---------------------------------------------------------------------- .../query/GridQueryCacheObjectsIterator.java | 70 ++++++++++++++++++++ .../query/GridQueryPortableFieldsIterator.java | 70 -------------------- .../processors/query/GridQueryProcessor.java | 2 +- .../h2/twostep/GridReduceQueryExecutor.java | 2 +- 4 files changed, 72 insertions(+), 72 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62f93c20/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCacheObjectsIterator.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCacheObjectsIterator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCacheObjectsIterator.java new file mode 100644 index 0000000..3dc7ddc --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCacheObjectsIterator.java @@ -0,0 +1,70 @@ +/* + * 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.query; + +import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.util.typedef.internal.*; + +import java.util.*; + +/** + * Deserializes portable objects if needed. + */ +public class GridQueryCacheObjectsIterator implements Iterator<List<?>>, AutoCloseable { + /** */ + private final Iterator<List<?>> iter; + + /** */ + private final GridCacheContext<?,?> cctx; + + /** */ + private final boolean keepPortable; + + /** + * @param iter Iterator. + * @param cctx Cache context. + * @param keepPortable Keep portable. + */ + public GridQueryCacheObjectsIterator(Iterator<List<?>> iter, GridCacheContext<?,?> cctx, boolean keepPortable) { + this.iter = iter; + this.cctx = cctx; + this.keepPortable = keepPortable; + } + + /** {@inheritDoc} */ + @Override public void close() throws Exception { + if (iter instanceof AutoCloseable) + U.closeQuiet((AutoCloseable)iter); + } + + /** {@inheritDoc} */ + @Override public boolean hasNext() { + return iter.hasNext(); + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override public List<?> next() { + return (List<?>)cctx.unwrapPortablesIfNeeded((Collection<Object>)iter.next(), keepPortable); + } + + /** {@inheritDoc} */ + @Override public void remove() { + iter.remove(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62f93c20/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryPortableFieldsIterator.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryPortableFieldsIterator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryPortableFieldsIterator.java deleted file mode 100644 index 8ccebe2..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryPortableFieldsIterator.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.query; - -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.util.*; - -/** - * Deserializes portable objects if needed. - */ -public class GridQueryPortableFieldsIterator implements Iterator<List<?>>, AutoCloseable { - /** */ - private final Iterator<List<?>> iter; - - /** */ - private final GridCacheContext<?,?> cctx; - - /** */ - private final boolean keepPortable; - - /** - * @param iter Iterator. - * @param cctx Cache context. - * @param keepPortable Keep portable. - */ - public GridQueryPortableFieldsIterator(Iterator<List<?>> iter, GridCacheContext<?,?> cctx, boolean keepPortable) { - this.iter = iter; - this.cctx = cctx; - this.keepPortable = keepPortable; - } - - /** {@inheritDoc} */ - @Override public void close() throws Exception { - if (iter instanceof AutoCloseable) - U.closeQuiet((AutoCloseable)iter); - } - - /** {@inheritDoc} */ - @Override public boolean hasNext() { - return iter.hasNext(); - } - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override public List<?> next() { - return (List<?>)cctx.unwrapPortablesIfNeeded((Collection<Object>)iter.next(), keepPortable); - } - - /** {@inheritDoc} */ - @Override public void remove() { - iter.remove(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62f93c20/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java index 547b707..63fe7ac 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java @@ -581,7 +581,7 @@ public class GridQueryProcessor extends GridProcessorAdapter { } QueryCursorImpl<List<?>> cursor = new QueryCursorImpl<>( - new GridQueryPortableFieldsIterator(res.iterator(), cctx, cctx.keepPortable())); + new GridQueryCacheObjectsIterator(res.iterator(), cctx, cctx.keepPortable())); cursor.fieldsMeta(res.metaData()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/62f93c20/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java index 9195153..fa58c76 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java @@ -310,7 +310,7 @@ public class GridReduceQueryExecutor implements GridMessageListener { // dropTable(r.conn, tbl.getName()); TODO } - return new QueryCursorImpl<>(new GridQueryPortableFieldsIterator(new Iter(res), cctx, cctx.keepPortable())); + return new QueryCursorImpl<>(new GridQueryCacheObjectsIterator(new Iter(res), cctx, cctx.keepPortable())); } catch (IgniteCheckedException | InterruptedException | RuntimeException e) { U.closeQuiet(r.conn);