Merge branches 'ignite-432' and 'ignite-sprint-2' of github.com:ggprivate/ggprivate into ignite-432
Conflicts: modules/core/src/main/java/org/gridgain/grid/internal/interop/GridInteropCache.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/291f3bae Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/291f3bae Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/291f3bae Branch: refs/heads/ignite-409 Commit: 291f3bae60f2dc3ad75a64bf5c78be2569804ca8 Parents: 7a274d3 Author: Yakov Zhdanov <yzhda...@gridgain.com> Authored: Wed Mar 18 16:58:07 2015 +0300 Committer: Yakov Zhdanov <yzhda...@gridgain.com> Committed: Wed Mar 18 16:58:07 2015 +0300 ---------------------------------------------------------------------- .../ignite/cache/query/ContinuousQuery.java | 4 +--- .../ignite/internal/util/lang/GridFunc.java | 23 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/291f3bae/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java index 2f0642e..169c4be 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java @@ -37,8 +37,6 @@ import javax.cache.event.*; * Note that in case query is distributed and a new node joins, it will get the remote * filter for the query during discovery process before it actually joins topology, * so no updates will be missed. - * <p> - * To create a new instance of continuous query use {@link Query#continuous()} factory method. * <h1 class="header">Example</h1> * As an example, suppose we have cache with {@code 'Person'} objects and we need * to query all persons with salary above 1000. @@ -59,7 +57,7 @@ import javax.cache.event.*; * You can create and execute continuous query like so: * <pre name="code" class="java"> * // Create new continuous query. - * ContinuousQuery qry = Query.continuous(); + * ContinuousQuery<UUID, Person> qry = new ContinuousQuery<>(); * * // Initial iteration query will return all persons with salary above 1000. * qry.setInitialQuery(Query.scan(new IgniteBiPredicate<UUID, Person>() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/291f3bae/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java index a33bf2c..e25448f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java @@ -333,6 +333,17 @@ public class GridFunc { }; /** */ + private static final IgniteClosure MAP_ENTRY_KEY = new IgniteClosure() { + @Override public Object apply(Object o) { + return ((Map.Entry)o).getKey(); + } + + @Override public String toString() { + return "Map entry to key transformer closure."; + } + }; + + /** */ private static final IgniteClosure CACHE_ENTRY_KEY = new IgniteClosure() { @Override public Object apply(Object o) { return ((Cache.Entry)o).getKey(); @@ -7656,6 +7667,18 @@ public class GridFunc { } /** + * Gets closure that returns key for an entry. The closure internally + * delegates to {@link Map.Entry#getKey()} method. + * + * @param <K> Key type. + * @return Closure that returns key for an entry. + */ + @SuppressWarnings({"unchecked"}) + public static <K> IgniteClosure<Map.Entry<K, ?>, K> mapEntry2Key() { + return (IgniteClosure<Map.Entry<K, ?>, K>)MAP_ENTRY_KEY; + } + + /** * Gets closure that returns key for cache entry. The closure internally * delegates to {@link javax.cache.Cache.Entry#getKey()} method. *