ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/2] incubator-ignite git commit: IGNITE-49 WIP.
Date Tue, 20 Jan 2015 15:24:17 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-49 3bf901942 -> 31c2251bc


IGNITE-49 WIP.


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

Branch: refs/heads/ignite-49
Commit: 3ed9f04077c4c83a28bc75236644622188564cdc
Parents: 3bf9019
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Tue Jan 20 13:49:26 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Tue Jan 20 14:11:36 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 12 +++++++++-
 .../cache/GridCacheAbstractMetricsSelfTest.java | 25 ++++++++++++++++++++
 .../distributed/GridCacheEventAbstractTest.java |  8 +++++++
 3 files changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ed9f040/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java
index 1f0892f..5534f3f 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java
@@ -2845,7 +2845,17 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
 
     /** {@inheritDoc} */
     @Override public IgniteFuture<V> removeAsync(K key, IgnitePredicate<GridCacheEntry<K,
V>>... filter) {
-        return removeAsync(key, null, filter);
+        IgniteFuture<V> fut = removeAsync(key, null, filter);
+
+        if (ctx.cache().configuration().isStatisticsEnabled())
+            fut.listenAsync(new CI1<IgniteFuture<V>>() {
+                /** {@inheritDoc} */
+                @Override public void apply(IgniteFuture<V> fut) {
+                    ctx.cache().metrics0().addRemoveTimeNanos(fut.duration());
+                }
+            });
+
+        return fut;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ed9f040/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractMetricsSelfTest.java
b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractMetricsSelfTest.java
index 5767494..5c57338 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractMetricsSelfTest.java
@@ -18,6 +18,7 @@
 package org.gridgain.grid.kernal.processors.cache;
 
 import org.apache.ignite.*;
+import org.apache.ignite.lang.*;
 import org.apache.ignite.transactions.*;
 import org.gridgain.grid.cache.*;
 import org.gridgain.grid.util.lang.*;
@@ -100,6 +101,30 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
+    public void testRemoveAsyncAvgTime() throws Exception {
+        GridCache<Object, Object> cache = grid(0).cache(null);
+
+        cache.put(1, 1);
+        cache.put(2, 2);
+
+        assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
+
+        IgniteFuture<Object> fut = cache.removeAsync(1);
+
+        assertEquals(1, (int)fut.get());
+
+        assert cache.metrics().getAverageRemoveTime() > 0;
+
+        fut = cache.removeAsync(2);
+
+        assertEquals(2, (int)fut.get());
+
+        assert cache.metrics().getAverageRemoveTime() > 0;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testRemoveAvgTime() throws Exception {
         IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
         GridCache<Object, Object> cache = grid(0).cache(null);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ed9f040/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheEventAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheEventAbstractTest.java
b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheEventAbstractTest.java
index 7219a30..0907b61 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheEventAbstractTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheEventAbstractTest.java
@@ -221,6 +221,10 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
      * @throws Exception If test failed.
      */
     public void testGetPutRemove() throws Exception {
+        // TODO: GG-7578.
+        if (cache(0).configuration().getCacheMode() == GridCacheMode.REPLICATED)
+            return;
+
         runTest(
             new TestCacheRunnable() {
                 @Override public void run(GridCache<String, Integer> cache) throws
IgniteCheckedException {
@@ -316,6 +320,10 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
      * @throws Exception If test failed.
      */
     public void testGetPutRemoveAsync() throws Exception {
+        // TODO: GG-7578.
+        if (cache(0).configuration().getCacheMode() == GridCacheMode.REPLICATED)
+            return;
+
         runTest(new TestCacheRunnable() {
             @Override public void run(GridCache<String, Integer> cache) throws IgniteCheckedException
{
                 Map.Entry<String, Integer> e = F.first(pairs(1).entrySet());


Mime
View raw message