ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [15/19] incubator-ignite git commit: IGNITE-49 Moved time stat from IgniteCacheProxy to GridCacheAdapter. Removed tests stub and uncommented tests.
Date Tue, 20 Jan 2015 09:16:10 GMT
IGNITE-49 Moved time stat from IgniteCacheProxy to GridCacheAdapter. Removed tests stub and
uncommented tests.


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

Branch: refs/heads/ignite-49
Commit: 3ea7ea070a5a94b42ae1b69273e3ebf9339bcd0a
Parents: f5b3536
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Mon Jan 19 17:39:07 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Mon Jan 19 17:39:07 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/IgniteCacheProxy.java      | 136 ++-----------------
 .../processors/cache/GridCacheAdapter.java      | 114 ++++++++++++++--
 .../cache/GridCacheMetricsAdapter.java          |  10 ++
 .../cache/GridCacheAbstractMetricsSelfTest.java |  32 -----
 .../distributed/GridCacheEventAbstractTest.java |   8 --
 .../GridCachePartitionedMetricsSelfTest.java    |  10 --
 .../GridCacheMetricsSelfTestSuite.java          |   2 +-
 7 files changed, 121 insertions(+), 191 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ea7ea07/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 0f744e9..363e0df 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -455,23 +455,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
-            V res;
-
             try {
-                res = delegate.get(key);
+                return delegate.get(key);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled)
-                ctx.cache().metrics0().addGetTimeNanos(System.nanoTime() - start);
-
-            return res;
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);
@@ -483,23 +472,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
-            Map<K, V> res;
-
             try {
-                res = delegate.getAll(keys);
+                return delegate.getAll(keys);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled)
-                ctx.cache().metrics0().addGetTimeNanos(System.nanoTime() - start);
-
-            return res;
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);
@@ -514,23 +492,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
-            Map<K, V> res;
-
             try {
-                res = delegate.getAll(keys);
+                return delegate.getAll(keys);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled)
-                ctx.cache().metrics0().addGetTimeNanos(System.nanoTime() - start);
-
-            return res;
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);
@@ -596,19 +563,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
             try {
                 delegate.putx(key, val);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled)
-                ctx.cache().metrics0().addPutTimeNanos(System.nanoTime() - start);
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);
@@ -620,25 +580,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
-            V ret;
-
             try {
-                ret = delegate.put(key, val);
+                return delegate.put(key, val);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled) {
-                ctx.cache().metrics0().addPutTimeNanos(System.nanoTime() - start);
-                ctx.cache().metrics0().addGetTimeNanos(System.nanoTime() - start);
-            }
-
-            return ret;
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);
@@ -650,19 +597,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
             try {
                 delegate.putAll(map);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled)
-                ctx.cache().metrics0().addPutTimeNanos(System.nanoTime() - start);
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);
@@ -674,23 +614,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
-            boolean stored;
-
             try {
-                stored = delegate.putxIfAbsent(key, val);
+                return delegate.putxIfAbsent(key, val);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled && stored)
-                ctx.cache().metrics0().addPutTimeNanos(System.nanoTime() - start);
-
-            return stored;
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);
@@ -702,23 +631,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
-            boolean removed;
-
             try {
-                removed = delegate.removex(key);
+                return delegate.removex(key);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled && removed)
-                ctx.cache().metrics0().addRemoveTimeNanos(System.nanoTime() - start);
-
-            return removed;
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);
@@ -730,23 +648,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
-            boolean removed;
-
             try {
-                removed = delegate.remove(key, oldVal);
+                return delegate.remove(key, oldVal);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled && removed)
-                ctx.cache().metrics0().addRemoveTimeNanos(System.nanoTime() - start);
-
-            return removed;
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);
@@ -758,25 +665,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
-            V removed;
-
             try {
-                removed = delegate.remove(key);
+                return delegate.remove(key);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled) {
-                ctx.cache().metrics0().addRemoveTimeNanos(System.nanoTime() - start);
-                ctx.cache().metrics0().addGetTimeNanos(System.nanoTime() - start);
-            }
-
-            return removed;
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);
@@ -839,19 +733,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
             try {
                 delegate.removeAll(keys);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled)
-                ctx.cache().metrics0().addRemoveTimeNanos(System.nanoTime() - start);
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);
@@ -865,19 +752,12 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter
implements
         try {
             GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
-            boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
-
-            long start = statisticsEnabled ? System.nanoTime() : 0L;
-
             try {
                 delegate.removeAll(keys);
             }
             finally {
                 gate.leave(prev);
             }
-
-            if (statisticsEnabled)
-                ctx.cache().metrics0().addRemoveTimeNanos(System.nanoTime() - start);
         }
         catch (IgniteCheckedException e) {
             throw cacheException(e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ea7ea07/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 0e8a268..84cd94c 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
@@ -1667,11 +1667,18 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
 
     /** {@inheritDoc} */
     @Nullable @Override public V get(K key) throws IgniteCheckedException {
+        boolean statsEnabled = ctx.config().isStatisticsEnabled();
+
+        long start = statsEnabled ? System.nanoTime() : 0L;
+
         V val = get(key, true, null);
 
         if (ctx.config().getInterceptor() != null)
             val = (V)ctx.config().getInterceptor().onGet(key, val);
 
+        if (statsEnabled)
+            ctx.cache().metrics0().addGetTimeNanos(System.nanoTime() - start);
+
         return val;
     }
 
@@ -1691,11 +1698,18 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
 
     /** {@inheritDoc} */
     @Override public Map<K, V> getAll(@Nullable Collection<? extends K> keys)
throws IgniteCheckedException {
+        boolean statsEnabled = ctx.config().isStatisticsEnabled();
+
+        long start = statsEnabled ? System.nanoTime() : 0L;
+
         Map<K, V> map = getAll(keys, true, null);
 
         if (ctx.config().getInterceptor() != null)
             map = interceptGet(keys, map);
 
+        if (statsEnabled)
+            ctx.cache().metrics0().addGetTimeNanos(System.nanoTime() - start);
+
         return map;
     }
 
@@ -2074,6 +2088,10 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
     /** {@inheritDoc} */
     @Nullable @Override public V put(final K key, final V val, @Nullable final GridCacheEntryEx<K,
V> cached,
         final long ttl, @Nullable final IgnitePredicate<GridCacheEntry<K, V>>[]
filter) throws IgniteCheckedException {
+        boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
+
+        long start = statisticsEnabled ? System.nanoTime() : 0L;
+
         A.notNull(key, "key", val, "val");
 
         if (keyCheck)
@@ -2083,15 +2101,24 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
 
         ctx.denyOnLocalRead();
 
-        return ctx.cloneOnFlag(syncOp(new SyncOp<V>(true) {
-            @Override public V op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException
{
+        V prevValue = ctx.cloneOnFlag(syncOp(new SyncOp<V>(true) {
+            @Override
+            public V op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException
{
                 return tx.putAllAsync(ctx, F.t(key, val), true, cached, ttl, filter).get().value();
             }
 
-            @Override public String toString() {
+            @Override
+            public String toString() {
                 return "put [key=" + key + ", val=" + val + ", filter=" + Arrays.toString(filter)
+ ']';
             }
         }));
+
+        if (statisticsEnabled) {
+            ctx.cache().metrics0().addPutTimeNanos(System.nanoTime() - start);
+            ctx.cache().metrics0().addGetTimeNanos(System.nanoTime() - start);
+        }
+
+        return prevValue;
     }
 
     /** {@inheritDoc} */
@@ -2154,6 +2181,10 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
     /** {@inheritDoc} */
     @Override public boolean putx(final K key, final V val,
         final IgnitePredicate<GridCacheEntry<K, V>>[] filter) throws IgniteCheckedException
{
+        boolean statsEnabled = ctx.config().isStatisticsEnabled();
+
+        long start = statsEnabled ? System.nanoTime() : 0L;
+
         A.notNull(key, "key", val, "val");
 
         if (keyCheck)
@@ -2163,7 +2194,7 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
 
         ctx.denyOnLocalRead();
 
-        return syncOp(new SyncOp<Boolean>(true) {
+        Boolean stored = syncOp(new SyncOp<Boolean>(true) {
             @Override
             public Boolean op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException
{
                 return tx.putAllAsync(ctx, F.t(key, val), false, null, -1, filter).get().success();
@@ -2174,6 +2205,11 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
                 return "putx [key=" + key + ", val=" + val + ", filter=" + Arrays.toString(filter)
+ ']';
             }
         });
+
+        if (statsEnabled)
+            ctx.cache().metrics0().addPutTimeNanos(System.nanoTime() - start);
+
+        return stored;
     }
 
     /** {@inheritDoc} */
@@ -2504,6 +2540,10 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
 
     /** {@inheritDoc} */
     @Override public boolean putxIfAbsent(final K key, final V val) throws IgniteCheckedException
{
+        boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
+
+        long start = statisticsEnabled ? System.nanoTime() : 0L;
+
         A.notNull(key, "key", val, "val");
 
         if (keyCheck)
@@ -2513,15 +2553,22 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
 
         ctx.denyOnLocalRead();
 
-        return syncOp(new SyncOp<Boolean>(true) {
-            @Override public Boolean op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException
{
+        Boolean stored = syncOp(new SyncOp<Boolean>(true) {
+            @Override
+            public Boolean op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException
{
                 return tx.putAllAsync(ctx, F.t(key, val), false, null, -1, ctx.noPeekArray()).get().success();
             }
 
-            @Override public String toString() {
+            @Override
+            public String toString() {
                 return "putxIfAbsent [key=" + key + ", val=" + val + ']';
             }
         });
+
+        if (statisticsEnabled && stored)
+            ctx.cache().metrics0().addPutTimeNanos(System.nanoTime() - start);
+
+        return stored;
     }
 
     /** {@inheritDoc} */
@@ -2705,6 +2752,10 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
     /** {@inheritDoc} */
     @Override public void putAll(@Nullable final Map<? extends K, ? extends V> m,
         final IgnitePredicate<GridCacheEntry<K, V>>[] filter) throws IgniteCheckedException
{
+        boolean statsEnabled = ctx.config().isStatisticsEnabled();
+
+        long start = statsEnabled ? System.nanoTime() : 0L;
+
         if (F.isEmpty(m))
             return;
 
@@ -2724,6 +2775,9 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
                 return "putAll [map=" + m + ", filter=" + Arrays.toString(filter) + ']';
             }
         });
+
+        if (statsEnabled)
+            ctx.cache().metrics0().addPutTimeNanos(System.nanoTime() - start);
     }
 
     /** {@inheritDoc} */
@@ -2759,6 +2813,10 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
     /** {@inheritDoc} */
     @Override public V remove(final K key, @Nullable final GridCacheEntryEx<K, V> entry,
         @Nullable final IgnitePredicate<GridCacheEntry<K, V>>... filter) throws
IgniteCheckedException {
+        boolean statsEnabled = ctx.config().isStatisticsEnabled();
+
+        long start = statsEnabled ? System.nanoTime() : 0L;
+
         ctx.denyOnLocalRead();
 
         A.notNull(key, "key");
@@ -2766,7 +2824,7 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
         if (keyCheck)
             validateCacheKey(key);
 
-        return ctx.cloneOnFlag(syncOp(new SyncOp<V>(true) {
+        V prevVal = ctx.cloneOnFlag(syncOp(new SyncOp<V>(true) {
             @Override public V op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException
{
                 V ret = tx.removeAllAsync(ctx, Collections.singletonList(key), entry, true,
filter).get().value();
 
@@ -2780,6 +2838,11 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
                 return "remove [key=" + key + ", filter=" + Arrays.toString(filter) + ']';
             }
         }));
+
+        if (statsEnabled)
+            ctx.cache().metrics0().addRemoveAndGetTimeNanos(System.nanoTime() - start);
+
+        return prevVal;
     }
 
     /** {@inheritDoc} */
@@ -2813,6 +2876,10 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
     /** {@inheritDoc} */
     @Override public void removeAll(@Nullable final Collection<? extends K> keys,
         final IgnitePredicate<GridCacheEntry<K, V>>... filter) throws IgniteCheckedException
{
+        boolean statsEnabled = ctx.config().isStatisticsEnabled();
+
+        long start = statsEnabled ? System.nanoTime() : 0L;
+
         ctx.denyOnLocalRead();
 
         if (F.isEmpty(keys))
@@ -2841,6 +2908,9 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
                 return "removeAll [keys=" + keys + ", filter=" + Arrays.toString(filter)
+ ']';
             }
         });
+
+        if (statsEnabled)
+            ctx.cache().metrics0().addRemoveTimeNanos(System.nanoTime() - start);
     }
 
     /** {@inheritDoc} */
@@ -2874,6 +2944,10 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
     /** {@inheritDoc} */
     @Override public boolean removex(final K key, @Nullable final GridCacheEntryEx<K,
V> entry,
         @Nullable final IgnitePredicate<GridCacheEntry<K, V>>... filter) throws
IgniteCheckedException {
+        boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
+
+        long start = statisticsEnabled ? System.nanoTime() : 0L;
+
         ctx.denyOnLocalRead();
 
         A.notNull(key, "key");
@@ -2881,15 +2955,22 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
         if (keyCheck)
             validateCacheKey(key);
 
-        return syncOp(new SyncOp<Boolean>(true) {
-            @Override public Boolean op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException
{
+        boolean removed = syncOp(new SyncOp<Boolean>(true) {
+            @Override
+            public Boolean op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException
{
                 return tx.removeAllAsync(ctx, Collections.singletonList(key), entry, false,
filter).get().success();
             }
 
-            @Override public String toString() {
+            @Override
+            public String toString() {
                 return "removex [key=" + key + ", filter=" + Arrays.toString(filter) + ']';
             }
         });
+
+        if (statisticsEnabled && removed)
+            ctx.cache().metrics0().addRemoveTimeNanos(System.nanoTime() - start);
+
+        return removed;
     }
 
     /** {@inheritDoc} */
@@ -3070,6 +3151,10 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
 
     /** {@inheritDoc} */
     @Override public boolean remove(final K key, final V val) throws IgniteCheckedException
{
+        boolean statisticsEnabled = ctx.config().isStatisticsEnabled();
+
+        long start = statisticsEnabled ? System.nanoTime() : 0L;
+
         ctx.denyOnLocalRead();
 
         A.notNull(key, "key", val, "val");
@@ -3079,7 +3164,7 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
 
         validateCacheValue(val);
 
-        return syncOp(new SyncOp<Boolean>(true) {
+        boolean removed = syncOp(new SyncOp<Boolean>(true) {
             @Override public Boolean op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException
{
                 // Register before hiding in the filter.
                 if (ctx.deploymentEnabled())
@@ -3098,6 +3183,11 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
                 return "remove [key=" + key + ", val=" + val + ']';
             }
         });
+
+        if (statisticsEnabled && removed)
+            ctx.cache().metrics0().addRemoveTimeNanos(System.nanoTime() - start);
+
+        return removed;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ea7ea07/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMetricsAdapter.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMetricsAdapter.java
index ada12ff..e30b38b 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMetricsAdapter.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMetricsAdapter.java
@@ -269,6 +269,16 @@ public class GridCacheMetricsAdapter implements GridCacheMetrics, Externalizable
         removeTimeNanos += duration;
     }
 
+    /**
+     * Increments the remove and get time accumulators.
+     *
+     * @param duration the time taken in nanoseconds.
+     */
+    public void addRemoveAndGetTimeNanos(long duration) {
+        removeTimeNanos += duration;
+        getTimeNanos += duration;
+    }
+
     /** {@inheritDoc} */
     @Override public float getAverageGetTime() {
         long timeNanos = getTimeNanos;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ea7ea07/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 c141bc3..59b70b3 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
@@ -104,10 +104,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testRemoveAvgTime() throws Exception {
-        // TODO: GG-7578.
-        if (cache().configuration().getCacheMode() == GridCacheMode.REPLICATED)
-            return;
-
         IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
         GridCache<Object, Object> cache = grid(0).cache(null);
 
@@ -131,10 +127,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testRemoveAllAvgTime() throws Exception {
-        // TODO: GG-7578.
-        if (cache().configuration().getCacheMode() == GridCacheMode.REPLICATED)
-            return;
-
         IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
         GridCache<Object, Object> cache = grid(0).cache(null);
 
@@ -160,10 +152,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAvgTime() throws Exception {
-        // TODO: GG-7578.
-        if (cache().configuration().getCacheMode() == GridCacheMode.REPLICATED)
-            return;
-
         IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
         GridCache<Object, Object> cache = grid(0).cache(null);
 
@@ -191,10 +179,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAllAvgTime() throws Exception {
-        // TODO: GG-7578.
-        if (cache().configuration().getCacheMode() == GridCacheMode.REPLICATED)
-            return;
-
         IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
         GridCache<Object, Object> cache = grid(0).cache(null);
 
@@ -222,10 +206,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testPutAvgTime() throws Exception {
-        // TODO: GG-7578.
-        if (cache().configuration().getCacheMode() == GridCacheMode.REPLICATED)
-            return;
-
         IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
         GridCache<Object, Object> cache = grid(0).cache(null);
 
@@ -251,10 +231,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testPutAllAvgTime() throws Exception {
-        // TODO: GG-7578.
-        if (cache().configuration().getCacheMode() == GridCacheMode.REPLICATED)
-            return;
-
         IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
         GridCache<Object, Object> cache = grid(0).cache(null);
 
@@ -373,10 +349,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testMisses() throws Exception {
         GridCache<Integer, Integer> cache = grid(0).cache(null);
 
-        // TODO: GG-7578.
-        if (cache.configuration().getCacheMode() == GridCacheMode.REPLICATED)
-            return;
-
         int keyCnt = keyCount();
 
         int expReads = 0;
@@ -418,10 +390,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testMissesOnEmptyCache() throws Exception {
         GridCache<Integer, Integer> cache = grid(0).cache(null);
 
-        // TODO: GG-7578.
-        if (cache.configuration().getCacheMode() == GridCacheMode.REPLICATED)
-            return;
-
         Integer key =  null;
 
         for (int i = 0; i < 1000; i++) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ea7ea07/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 0907b61..7219a30 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,10 +221,6 @@ 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 {
@@ -320,10 +316,6 @@ 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());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ea7ea07/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedMetricsSelfTest.java
b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedMetricsSelfTest.java
index d7b37c4..472f544 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedMetricsSelfTest.java
@@ -57,14 +57,4 @@ public class GridCachePartitionedMetricsSelfTest extends GridCacheTransactionalA
     @Override protected int gridCount() {
         return GRID_CNT;
     }
-
-    /** {@inheritDoc} */
-    @Override public void testGetAllAvgTime() throws Exception {
-        //TODO: GG-7578
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testGetAvgTime() throws Exception {
-        //TODO: GG-7578
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ea7ea07/modules/core/src/test/java/org/gridgain/testsuites/GridCacheMetricsSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/testsuites/GridCacheMetricsSelfTestSuite.java
b/modules/core/src/test/java/org/gridgain/testsuites/GridCacheMetricsSelfTestSuite.java
index 24dca75..c7dd97e 100644
--- a/modules/core/src/test/java/org/gridgain/testsuites/GridCacheMetricsSelfTestSuite.java
+++ b/modules/core/src/test/java/org/gridgain/testsuites/GridCacheMetricsSelfTestSuite.java
@@ -33,7 +33,7 @@ public class GridCacheMetricsSelfTestSuite extends TestSuite {
     public static TestSuite suite() throws Exception {
         TestSuite suite = new TestSuite("Gridgain Cache Metrics Test Suite");
 
-//        suite.addTest(new TestSuite(GridCacheLocalMetricsSelfTest.class));
+        suite.addTest(new TestSuite(GridCacheLocalMetricsSelfTest.class));
         suite.addTest(new TestSuite(GridCacheNearMetricsSelfTest.class));
         suite.addTest(new TestSuite(GridCacheReplicatedMetricsSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedMetricsSelfTest.class));


Mime
View raw message