ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [1/2] incubator-ignite git commit: # IGNITE-45 - Examples
Date Sun, 22 Mar 2015 05:45:32 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-45 a57ada587 -> 27fbfc6be


# IGNITE-45 - Examples


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

Branch: refs/heads/ignite-45
Commit: b052ac129c8c8cd270a70a6757bd8f83a10029cd
Parents: 19cf044
Author: Valentin Kulichenko <vkulichenko@gridgain.com>
Authored: Sat Mar 21 22:47:04 2015 -0700
Committer: Valentin Kulichenko <vkulichenko@gridgain.com>
Committed: Sat Mar 21 22:47:04 2015 -0700

----------------------------------------------------------------------
 .../streaming/marketdata/StreamMarketData.java       |  2 +-
 .../java/org/apache/ignite/stream/StreamVisitor.java | 15 +++------------
 2 files changed, 4 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b052ac12/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/StreamMarketData.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/StreamMarketData.java
b/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/StreamMarketData.java
index e1a59d7..d7363e2 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/StreamMarketData.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/marketdata/StreamMarketData.java
@@ -64,7 +64,7 @@ public class StreamMarketData {
                 // Instead we update the instruments in the 'instCache'.
                 mktStmr.receiver(new StreamVisitor<String, MarketTick>() {
                     @Override
-                    public void visit(IgniteCache<String, MarketTick> mktCache, Map.Entry<String,
MarketTick> e) {
+                    public void apply(IgniteCache<String, MarketTick> cache, Map.Entry<String,
MarketTick> e) {
                         String symbol = e.getKey();
                         MarketTick tick = e.getValue();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b052ac12/modules/core/src/main/java/org/apache/ignite/stream/StreamVisitor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/StreamVisitor.java b/modules/core/src/main/java/org/apache/ignite/stream/StreamVisitor.java
index 44bc818..b97263f 100644
--- a/modules/core/src/main/java/org/apache/ignite/stream/StreamVisitor.java
+++ b/modules/core/src/main/java/org/apache/ignite/stream/StreamVisitor.java
@@ -27,26 +27,17 @@ import java.util.*;
  * does not update the cache. If the tuple needs to be stored in the cache,
  * then {@code cache.put(...)} should be called explicitely.
  */
-public abstract class StreamVisitor<K, V> implements StreamReceiver<K, V> {
+public abstract class StreamVisitor<K, V> implements StreamReceiver<K, V>, IgniteBiInClosure<IgniteCache<K,
V>, Map.Entry<K, V>> {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** {@inheritDoc} */
     @Override public void receive(IgniteCache<K, V> cache, Collection<Map.Entry<K,
V>> entries) throws IgniteException {
         for (Map.Entry<K, V> entry : entries)
-            visit(cache, entry);
+            apply(cache, entry);
     }
 
     /**
-     * Visits one cache entry.
-     *
-     * @param cache Cache.
-     * @param entry Visited entry.
-     * @throws IgniteException In case of error.
-     */
-    protected abstract void visit(IgniteCache<K, V> cache, Map.Entry<K, V> entry)
throws IgniteException;
-
-    /**
      * Creates a new visitor based on instance of {@link IgniteBiInClosure}.
      *
      * @param c Closure.
@@ -54,7 +45,7 @@ public abstract class StreamVisitor<K, V> implements StreamReceiver<K,
V> {
      */
     public static <K, V> StreamVisitor<K, V> from(final IgniteBiInClosure<IgniteCache<K,
V>, Map.Entry<K, V>> c) {
         return new StreamVisitor<K, V>() {
-            @Override protected void visit(IgniteCache<K, V> cache, Map.Entry<K,
V> entry) {
+            @Override public void apply(IgniteCache<K, V> cache, Map.Entry<K, V>
entry) {
                 c.apply(cache, entry);
             }
         };


Mime
View raw message