You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ni...@apache.org on 2018/05/18 14:12:44 UTC

ignite git commit: IGNITE-8528: Example fixed - Fixes #4025.

Repository: ignite
Updated Branches:
  refs/heads/master f8ae30d5d -> e078245d3


IGNITE-8528: Example fixed - Fixes #4025.

Signed-off-by: Nikolay Izhikov <ni...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e078245d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e078245d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e078245d

Branch: refs/heads/master
Commit: e078245d3813eb2ea26fc7b27d8e171942053c0d
Parents: f8ae30d
Author: Nikolay Izhikov <ni...@apache.org>
Authored: Fri May 18 17:05:01 2018 +0300
Committer: Nikolay Izhikov <ni...@apache.org>
Committed: Fri May 18 17:05:01 2018 +0300

----------------------------------------------------------------------
 ...heContinuousQueryWithTransformerExample.java | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e078245d/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryWithTransformerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryWithTransformerExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryWithTransformerExample.java
index ece4f88..674ebd5 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryWithTransformerExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryWithTransformerExample.java
@@ -21,19 +21,16 @@ import java.sql.Timestamp;
 import java.util.HashMap;
 import java.util.Map;
 import javax.cache.Cache;
-import javax.cache.configuration.Factory;
-import javax.cache.configuration.FactoryBuilder;
-import javax.cache.event.CacheEntryEvent;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
+import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.examples.ExampleNodeStartup;
 import org.apache.ignite.examples.model.Address;
 import org.apache.ignite.examples.model.Organization;
 import org.apache.ignite.examples.model.OrganizationType;
-import org.apache.ignite.lang.IgniteClosure;
 
 /**
  * This example demonstrates how to use continuous queries together with the transformer APIs.
@@ -71,20 +68,17 @@ public class CacheContinuousQueryWithTransformerExample {
             System.out.println(">>> Cache continuous query with transformer example started.");
 
             // Auto-close cache at the end of the example.
-            try (IgniteCache<Integer, Organization> cache = ignite.getOrCreateCache(CACHE_NAME)) {
+            try (IgniteCache<Integer, Organization> cache = ignite.getOrCreateCache(CACHE_NAME).withKeepBinary()) {
                 // Create new continuous query with transformer.
                 ContinuousQueryWithTransformer<Integer, Organization, String> qry =
                     new ContinuousQueryWithTransformer<>();
 
                 // Factory to create transformers.
-                Factory<IgniteClosure<CacheEntryEvent<? extends Integer, ? extends Organization>, String>> factory =
-                    FactoryBuilder.factoryOf(
-                        // Return one field of complex object.
-                        // Only this field will be sent over to a local node over the network.
-                        (IgniteClosure<CacheEntryEvent<? extends Integer, ? extends Organization>, String>)
-                            event -> event.getValue().name());
-
-                qry.setRemoteTransformerFactory(factory);
+                qry.setRemoteTransformerFactory(() -> {
+                    // Return one field of complex object.
+                    // Only this field will be sent over to a local node over the network.
+                    return event -> ((BinaryObject)event.getValue()).field("name");
+                });
 
                 // Listener that will receive transformed data.
                 qry.setLocalListener(names -> {