ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [14/22] incubator-ignite git commit: IGNITE-49 Changed interface GridCacheMetrics
Date Thu, 22 Jan 2015 13:20:23 GMT
IGNITE-49 Changed interface GridCacheMetrics


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

Branch: refs/heads/ignite-49
Commit: ea7f5252e1f9d9473c9e7c83e835780c82a0ad99
Parents: 1fd63cd
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Thu Jan 22 13:27:52 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Thu Jan 22 13:27:52 2015 +0300

----------------------------------------------------------------------
 .../integration/GridClientAbstractSelfTest.java |  18 +--
 .../GridClientMemcachedProtocolSelfTest.java    |   4 +-
 .../rest/GridRestBinaryProtocolSelfTest.java    |   4 +-
 .../rest/GridRestMemcacheProtocolSelfTest.java  |   4 +-
 .../java/org/apache/ignite/IgniteCache.java     |   7 +
 .../org/apache/ignite/IgniteCacheManager.java   |  48 +++---
 .../apache/ignite/cache/CacheMetricsMXBean.java |  99 ------------
 .../processors/cache/IgniteCacheProxy.java      |  12 ++
 .../gridgain/grid/cache/CacheMetricsMxBean.java |  56 +++++++
 .../java/org/gridgain/grid/cache/GridCache.java |   2 +-
 .../gridgain/grid/cache/GridCacheMetrics.java   | 104 -------------
 .../processors/cache/GridCacheAdapter.java      |  51 +++++--
 .../cache/GridCacheMetricsAdapter.java          | 100 ++-----------
 .../processors/cache/GridCacheProxyImpl.java    |   2 +-
 .../handlers/cache/GridCacheCommandHandler.java |   9 +-
 .../handlers/cache/GridCacheRestMetrics.java    |  77 +---------
 .../kernal/visor/cache/VisorCacheMetrics.java   |  44 +++---
 .../cache/GridCacheAbstractMetricsSelfTest.java |  74 ++++-----
 ...cheTransactionalAbstractMetricsSelfTest.java |  16 +-
 ...ePartitionedNearDisabledMetricsSelfTest.java |  14 +-
 .../near/GridCacheNearMetricsSelfTest.java      | 150 +++++++++----------
 ...idCachePartitionedHitsAndMissesSelfTest.java |   6 +-
 22 files changed, 324 insertions(+), 577 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractSelfTest.java b/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractSelfTest.java
index 58d6894..010637f 100644
--- a/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractSelfTest.java
@@ -957,31 +957,31 @@ public abstract class GridClientAbstractSelfTest extends GridCommonAbstractTest
 
         GridClientDataMetrics m = dfltData.metrics();
 
-        GridCacheMetrics metrics = grid().cache(null).metrics();
+        CacheMetricsMxBean metrics = grid().cache(null).metrics();
 
         assertNotNull(m);
-        assertEquals(metrics.reads(), m.reads());
-        assertEquals(metrics.writes(), m.writes());
+        assertEquals(metrics.getCacheGets(), m.reads());
+        assertEquals(metrics.getCachePuts(), m.writes());
 
         m = dfltData.metricsAsync().get();
 
         assertNotNull(m);
-        assertEquals(metrics.reads(), m.reads());
-        assertEquals(metrics.writes(), m.writes());
+        assertEquals(metrics.getCacheGets(), m.reads());
+        assertEquals(metrics.getCachePuts(), m.writes());
 
         m = namedData.metrics();
 
         metrics = grid().cache(CACHE_NAME).metrics();
 
         assertNotNull(m);
-        assertEquals(metrics.reads(), m.reads());
-        assertEquals(metrics.writes(), m.writes());
+        assertEquals(metrics.getCacheGets(), m.reads());
+        assertEquals(metrics.getCachePuts(), m.writes());
 
         m = namedData.metricsAsync().get();
 
         assertNotNull(m);
-        assertEquals(metrics.reads(), m.reads());
-        assertEquals(metrics.writes(), m.writes());
+        assertEquals(metrics.getCacheGets(), m.reads());
+        assertEquals(metrics.getCachePuts(), m.writes());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridClientMemcachedProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridClientMemcachedProtocolSelfTest.java b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridClientMemcachedProtocolSelfTest.java
index 915c776..a41f847 100644
--- a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridClientMemcachedProtocolSelfTest.java
+++ b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridClientMemcachedProtocolSelfTest.java
@@ -257,7 +257,7 @@ public class GridClientMemcachedProtocolSelfTest extends GridAbstractRestProcess
 
         Map<String, String> stats = F.first(map.values());
 
-        Assert.assertEquals(7, stats.size());
+        Assert.assertEquals(4, stats.size());
         Assert.assertTrue(Integer.valueOf(stats.get("writes")) >= 1);
         Assert.assertTrue(Integer.valueOf(stats.get("reads")) >= 1);
 
@@ -270,7 +270,7 @@ public class GridClientMemcachedProtocolSelfTest extends GridAbstractRestProcess
 
         stats = F.first(map.values());
 
-        Assert.assertEquals(7, stats.size());
+        Assert.assertEquals(4, stats.size());
         Assert.assertTrue(Integer.valueOf(stats.get("writes")) >= 2);
         Assert.assertTrue(Integer.valueOf(stats.get("reads")) >= 2);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestBinaryProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestBinaryProtocolSelfTest.java b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestBinaryProtocolSelfTest.java
index 323bf09..1e0f794 100644
--- a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestBinaryProtocolSelfTest.java
+++ b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestBinaryProtocolSelfTest.java
@@ -403,14 +403,14 @@ public class GridRestBinaryProtocolSelfTest extends GridCommonAbstractTest {
         Map<String, Long> m = client.cacheMetrics(null);
 
         assertNotNull(m);
-        assertEquals(7, m.size());
+        assertEquals(4, m.size());
         assertEquals(3, m.get("reads").longValue());
         assertEquals(3, m.get("writes").longValue());
 
         m = client.cacheMetrics(CACHE_NAME);
 
         assertNotNull(m);
-        assertEquals(7, m.size());
+        assertEquals(4, m.size());
         assertEquals(3, m.get("reads").longValue());
         assertEquals(3, m.get("writes").longValue());
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestMemcacheProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestMemcacheProtocolSelfTest.java b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestMemcacheProtocolSelfTest.java
index a5b2a60..4e0f15d 100644
--- a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestMemcacheProtocolSelfTest.java
+++ b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestMemcacheProtocolSelfTest.java
@@ -228,14 +228,14 @@ public class GridRestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
         Map<String, Long> m = client.cacheMetrics(null);
 
         assertNotNull(m);
-        assertEquals(7, m.size());
+        assertEquals(4, m.size());
         assertEquals(3, m.get("reads").longValue());
         assertEquals(3, m.get("writes").longValue());
 
         m = client.cacheMetrics(CACHE_NAME);
 
         assertNotNull(m);
-        assertEquals(7, m.size());
+        assertEquals(4, m.size());
         assertEquals(3, m.get("reads").longValue());
         assertEquals(3, m.get("writes").longValue());
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index 1398ebe..edebee9 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -517,4 +517,11 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @return Ignite instance.
      */
     public Ignite ignite();
+
+    /**
+     * Gets metrics (statistics) for this cache.
+     *
+     * @return Cache metrics.
+     */
+    public CacheMetricsMxBean metrics();
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/main/java/org/apache/ignite/IgniteCacheManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCacheManager.java b/modules/core/src/main/java/org/apache/ignite/IgniteCacheManager.java
index fea39ca..c4c329a 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCacheManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCacheManager.java
@@ -36,6 +36,12 @@ import java.util.concurrent.atomic.*;
  */
 public class IgniteCacheManager implements CacheManager {
     /** */
+    private static final String CACHE_STATISTICS = "CacheStatistics";
+
+    /** */
+    private static final String CACHE_CONFIGURATION = "CacheConfiguration";
+
+    /** */
     private final Map<String, IgniteBiTuple<Ignite, IgniteCacheMXBean>> igniteMap = new HashMap<>();
 
     /** */
@@ -256,19 +262,17 @@ public class IgniteCacheManager implements CacheManager {
 
             MBeanServer mBeanSrv = tuple.get1().configuration().getMBeanServer();
 
-            unregisterCacheObject(mBeanSrv, cacheName, true);
+            unregisterCacheObject(mBeanSrv, cacheName, CACHE_STATISTICS);
 
-            unregisterCacheObject(mBeanSrv, cacheName, false);
+            unregisterCacheObject(mBeanSrv, cacheName, CACHE_CONFIGURATION);
         }
     }
 
     /**
      * @param cacheName Cache name.
      */
-    private ObjectName getObjectName(String cacheName, boolean isStatistic) {
-        String mbType = isStatistic ? "CacheStatistics" : "CacheConfiguration";
-
-        String mBeanName = "javax.cache:type=" + mbType + ",CacheManager="
+    private ObjectName getObjectName(String cacheName, String objectName) {
+        String mBeanName = "javax.cache:type=" + objectName + ",CacheManager="
             + uri.toString().replaceAll(",|:|=|\n", ".")
             + ",Cache=" + cacheName.replaceAll(",|:|=|\n", ".");
 
@@ -296,11 +300,11 @@ public class IgniteCacheManager implements CacheManager {
         MBeanServer mBeanSrv = tuple.get1().configuration().getMBeanServer();
 
         if (enabled) {
-            registerCacheObject(mBeanSrv, tuple.get2(), cacheName, false);
+            registerCacheObject(mBeanSrv, tuple.get2(), cacheName, CACHE_CONFIGURATION);
 
             tuple.get1().cache(cacheName).configuration().setManagementEnabled(true);
         } else {
-            unregisterCacheObject(mBeanSrv, cacheName, false);
+            unregisterCacheObject(mBeanSrv, cacheName, CACHE_CONFIGURATION);
 
             tuple.get1().cache(cacheName).configuration().setManagementEnabled(false);
         }
@@ -322,23 +326,21 @@ public class IgniteCacheManager implements CacheManager {
 
         Ignite ignite = tuple.get1();
 
-        GridCache cache = ignite.cache(cacheName);
+        IgniteCache<Object, Object> cache = ignite.jcache(cacheName);
 
-        GridCacheConfiguration configuration = ignite.jcache(cacheName).getConfiguration(GridCacheConfiguration.class);
+        GridCacheConfiguration cfg = cache.getConfiguration(GridCacheConfiguration.class);
 
         MBeanServer mBeanSrv = ignite.configuration().getMBeanServer();
 
         if (enabled) {
-            CacheMetricsMXBean mxBean = new CacheMetricsMXBean(cache);
-
-            registerCacheObject(mBeanSrv, mxBean, cacheName, true);
+            registerCacheObject(mBeanSrv, cache.metrics(), cacheName, CACHE_STATISTICS);
 
-            configuration.setStatisticsEnabled(true);
+            cfg.setStatisticsEnabled(true);
         }
         else {
-            unregisterCacheObject(mBeanSrv, cacheName, true);
+            unregisterCacheObject(mBeanSrv, cacheName, CACHE_STATISTICS);
 
-            configuration.setStatisticsEnabled(false);
+            cfg.setStatisticsEnabled(false);
         }
     }
 
@@ -346,8 +348,8 @@ public class IgniteCacheManager implements CacheManager {
      * @param mxbean MXBean.
      * @param name cache name.
      */
-    public void registerCacheObject(MBeanServer mBeanServer, Object mxbean, String name, boolean isStatistic) {
-        ObjectName registeredObjectName = getObjectName(name, isStatistic);
+    public void registerCacheObject(MBeanServer mBeanServer, Object mxbean, String name, String objectName) {
+        ObjectName registeredObjectName = getObjectName(name, objectName);
 
         try {
             if (!isRegistered(mBeanServer, registeredObjectName))
@@ -370,15 +372,15 @@ public class IgniteCacheManager implements CacheManager {
      * UnRegisters the mxbean if registered already.
      *
      * @param mBeanSrv MBean server
-     * @param name cache name.
-     * @param stats is mxbean, a statistics mxbean.
+     * @param name Cache name.
+     * @param objectName Mxbean name.
      */
-    public void unregisterCacheObject(MBeanServer mBeanSrv, String name, boolean stats) {
+    public void unregisterCacheObject(MBeanServer mBeanSrv, String name, String objectName) {
         Set<ObjectName> registeredObjectNames;
 
-        ObjectName objectName = getObjectName(name, stats);
+        ObjectName objName = getObjectName(name, objectName);
 
-        registeredObjectNames = mBeanSrv.queryNames(objectName, null);
+        registeredObjectNames = mBeanSrv.queryNames(objName, null);
 
         //should just be one
         for (ObjectName registeredObjectName : registeredObjectNames) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/main/java/org/apache/ignite/cache/CacheMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheMetricsMXBean.java
deleted file mode 100644
index 29a7805..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheMetricsMXBean.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache;
-
-import org.gridgain.grid.cache.*;
-
-import javax.cache.management.*;
-
-/**
- * Implementation of {@link CacheStatisticsMXBean}.
- */
-public class CacheMetricsMXBean implements CacheStatisticsMXBean {
-    /** Grid cache. */
-    private final GridCache cache;
-
-    /**
-     * Constructor.
-     *
-     * @param cache Cache.
-     */
-    public CacheMetricsMXBean(GridCache cache) {
-        this.cache = cache;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clear() {
-        cache.resetMetrics();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheHits() {
-        return cache.metrics().hits();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getCacheHitPercentage() {
-        return cache.metrics().getCacheHitPercentage();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheMisses() {
-        return cache.metrics().getCacheMisses();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getCacheMissPercentage() {
-        return cache.metrics().getCacheMissPercentage();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheGets() {
-        return cache.metrics().getCacheGets();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCachePuts() {
-        return cache.metrics().getCachePuts();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheRemovals() {
-        return cache.metrics().getCacheRemovals();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheEvictions() {
-        return cache.metrics().getCacheEvictions();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageGetTime() {
-        return cache.metrics().getAverageGetTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAveragePutTime() {
-        return cache.metrics().getAveragePutTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageRemoveTime() {
-        return cache.metrics().getAverageRemoveTime();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/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 31b17d8..4ae79b3 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
@@ -97,6 +97,18 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements
     }
 
     /** {@inheritDoc} */
+    @Override public CacheMetricsMxBean metrics() {
+        GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
+
+        try {
+            return ctx.cache().metrics();
+        }
+        finally {
+            gate.leave(prev);
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public <C extends Configuration<K, V>> C getConfiguration(Class<C> clazz) {
         GridCacheConfiguration cfg = ctx.config();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetricsMxBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetricsMxBean.java b/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetricsMxBean.java
new file mode 100644
index 0000000..63710fb
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetricsMxBean.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.gridgain.grid.cache;
+
+import javax.cache.management.*;
+import org.apache.ignite.*;
+
+/**
+ * Cache metrics used to obtain statistics on cache itself.
+ * Use {@link IgniteCache#metrics()} to obtain metrics for a cache.
+ */
+public interface CacheMetricsMxBean extends CacheStatisticsMXBean {
+    /**
+     * The mean time to execute tx commit.
+     *
+     * @return the time in ┬Ás
+     */
+    public float getAverageTxCommitTime();
+
+    /**
+     * The mean time to execute tx rollbacks.
+     *
+     * @return Number of transaction rollbacks.
+     */
+    public float getAverageTxRollbackTime();
+
+
+    /**
+     * Gets total number of transaction commits.
+     *
+     * @return Number of transaction commits.
+     */
+    public int getCacheTxCommits();
+
+    /**
+     * Gets total number of transaction rollbacks.
+     *
+     * @return Number of transaction rollbacks.
+     */
+    public int getCacheTxRollbacks();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java
index bc46201..753217f 100644
--- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java
+++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java
@@ -115,7 +115,7 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> {
      *
      * @return Cache metrics.
      */
-    public GridCacheMetrics metrics();
+    public CacheMetricsMxBean metrics();
 
     /**
      * Gets size (in bytes) of all entries swapped to disk.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMetrics.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMetrics.java
deleted file mode 100644
index d523c25..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMetrics.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.gridgain.grid.cache;
-
-import javax.cache.management.*;
-import java.io.*;
-
-/**
- * Cache metrics used to obtain statistics on cache itself.
- * Use {@link GridCache#metrics()} to obtain metrics for a cache.
- */
-public interface GridCacheMetrics extends CacheStatisticsMXBean, Serializable {
-    /**
-     * Gets create time of the owning entity (either cache or entry).
-     *
-     * @return Create time.
-     */
-    public long createTime();
-
-    /**
-     * Gets last write time of the owning entity (either cache or entry).
-     *
-     * @return Last write time.
-     */
-    public long writeTime();
-
-    /**
-     * Gets last read time of the owning entity (either cache or entry).
-     *
-     * @return Last read time.
-     */
-    public long readTime();
-
-    /**
-     * Gets last time transaction was committed.
-     *
-     * @return Last commit time.
-     */
-    public long commitTime();
-
-    /**
-     * Gets last time transaction was rollback.
-     *
-     * @return Last rollback time.
-     */
-    public long rollbackTime();
-
-    /**
-     * Gets total number of reads of the owning entity (either cache or entry).
-     *
-     * @return Total number of reads.
-     */
-    public int reads();
-
-    /**
-     * Gets total number of writes of the owning entity (either cache or entry).
-     *
-     * @return Total number of writes.
-     */
-    public int writes();
-
-    /**
-     * Gets total number of hits for the owning entity (either cache or entry).
-     *
-     * @return Number of hits.
-     */
-    public int hits();
-
-    /**
-     * Gets total number of misses for the owning entity (either cache or entry).
-     *
-     * @return Number of misses.
-     */
-    public int misses();
-
-    /**
-     * Gets total number of transaction commits.
-     *
-     * @return Number of transaction commits.
-     */
-    public int txCommits();
-
-    /**
-     * Gets total number of transaction rollbacks.
-     *
-     * @return Number of transaction rollbacks.
-     */
-    public int txRollbacks();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/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 258fd94..59421bf 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
@@ -1749,19 +1749,7 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter im
             });
 
         if (statsEnabled)
-            fut.listenAsync(new CI1<IgniteFuture<Map<K, V>>>() {
-                @Override public void apply(IgniteFuture<Map<K, V>> fut) {
-                    try {
-                        if (!fut.isCancelled()) {
-                            fut.get();
-
-                            ctx.cache().metrics0().addGetTimeNanos(System.nanoTime() - start);
-                        }
-                    } catch (IgniteCheckedException ignore) {
-                        //No-op.
-                    }
-                }
-            });
+            fut.listenAsync(new UpdateGetTimeMetricsClosure<Map<K, V>>(ctx.cache().metrics0(), start));
 
         return fut;
     }
@@ -3552,8 +3540,8 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter im
     }
 
     /** {@inheritDoc} */
-    @Override public GridCacheMetrics metrics() {
-        return GridCacheMetricsAdapter.copyOf(metrics);
+    @Override public CacheMetricsMxBean metrics() {
+        return metrics;
     }
 
     /**
@@ -5446,4 +5434,37 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter im
             return S.toString(GetExpiryPolicy.class, this);
         }
     }
+
+    /**
+     *
+     */
+    protected static class UpdateGetTimeMetricsClosure<T> implements CI1<IgniteFuture<T>> {
+        /** */
+        private final GridCacheMetricsAdapter metrics;
+
+        /** */
+        private final long start;
+
+        /**
+         * @param metrics Metrics.
+         * @param start   Start time.
+         */
+        public UpdateGetTimeMetricsClosure(GridCacheMetricsAdapter metrics, long start) {
+            this.metrics = metrics;
+            this.start = start;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void apply(IgniteFuture<T> fut) {
+            try {
+                if (!fut.isCancelled()) {
+                    fut.get();
+
+                    metrics.addGetTimeNanos(System.nanoTime() - start);
+                }
+            } catch (IgniteCheckedException ignore) {
+                //No-op.
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/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 c570c97..e4c106b 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
@@ -27,28 +27,13 @@ import java.io.*;
 /**
  * Adapter for cache metrics.
  */
-public class GridCacheMetricsAdapter implements GridCacheMetrics, Externalizable {
+public class GridCacheMetricsAdapter implements CacheMetricsMxBean, Externalizable {
     /** */
     private static final long NANOS_IN_MICROSECOND = 1000L;
 
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** Create time. */
-    private long createTime = U.currentTimeMillis();
-
-    /** Last read time. */
-    private volatile long readTime = createTime;
-
-    /** Last update time. */
-    private volatile long writeTime = createTime;
-
-    /** Last commit time. */
-    private volatile long commitTime = createTime;
-
-    /** Last rollback time. */
-    private volatile long rollbackTime = createTime;
-
     /** Number of reads. */
     private volatile int reads;
 
@@ -97,11 +82,6 @@ public class GridCacheMetricsAdapter implements GridCacheMetrics, Externalizable
      * @param m Metrics to copy from.
      */
     public GridCacheMetricsAdapter(GridCacheMetricsAdapter m) {
-        createTime = m.createTime;
-        readTime = m.readTime;
-        writeTime = m.writeTime;
-        commitTime = m.commitTime;
-        rollbackTime = m.rollbackTime;
         reads = m.reads;
         writes = m.writes;
         hits = m.hits;
@@ -123,73 +103,37 @@ public class GridCacheMetricsAdapter implements GridCacheMetrics, Externalizable
     }
 
     /** {@inheritDoc} */
-    @Override public long createTime() {
-        return createTime;
+    @Override public float getAverageTxCommitTime() {
+        return 1.f;
     }
 
     /** {@inheritDoc} */
-    @Override public long writeTime() {
-        return writeTime;
+    @Override public float getAverageTxRollbackTime() {
+        return 1.f;
     }
 
     /** {@inheritDoc} */
-    @Override public long readTime() {
-        return readTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long commitTime() {
-        return commitTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long rollbackTime() {
-        return rollbackTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int reads() {
-        return reads;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int writes() {
-        return (int)(writes + rmCnt);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hits() {
-        return hits;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int misses() {
-        return misses;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int txCommits() {
+    @Override public int getCacheTxCommits() {
         return txCommits;
     }
 
     /** {@inheritDoc} */
-    @Override public int txRollbacks() {
+    @Override public int getCacheTxRollbacks() {
         return txRollbacks;
     }
 
     /** {@inheritDoc} */
     @Override public void clear() {
-        createTime = U.currentTimeMillis();
-        readTime = createTime;
-        writeTime = createTime;
-        commitTime = createTime;
-        rollbackTime = createTime;
         reads = 0;
         writes = 0;
         hits = 0;
         misses = 0;
         txCommits = 0;
         txRollbacks = 0;
+
+        putTimeNanos = 0;
+        removeTimeNanos = 0;
+        getTimeNanos = 0;
     }
 
     /** {@inheritDoc} */
@@ -342,8 +286,6 @@ public class GridCacheMetricsAdapter implements GridCacheMetrics, Externalizable
      * @param isHit Hit or miss flag.
      */
     public void onRead(boolean isHit) {
-        readTime = U.currentTimeMillis();
-
         reads++;
 
         if (isHit)
@@ -359,8 +301,6 @@ public class GridCacheMetricsAdapter implements GridCacheMetrics, Externalizable
      * Cache write callback.
      */
     public void onWrite() {
-        writeTime = U.currentTimeMillis();
-
         writes++;
 
         if (delegate != null)
@@ -371,8 +311,6 @@ public class GridCacheMetricsAdapter implements GridCacheMetrics, Externalizable
      * Cache remove callback.
      */
     public void onRemove(){
-        writeTime = U.currentTimeMillis();
-
         rmCnt++;
 
         if (delegate != null)
@@ -393,8 +331,6 @@ public class GridCacheMetricsAdapter implements GridCacheMetrics, Externalizable
      * Transaction commit callback.
      */
     public void onTxCommit() {
-        commitTime = U.currentTimeMillis();
-
         txCommits++;
 
         if (delegate != null)
@@ -405,8 +341,6 @@ public class GridCacheMetricsAdapter implements GridCacheMetrics, Externalizable
      * Transaction rollback callback.
      */
     public void onTxRollback() {
-        rollbackTime = U.currentTimeMillis();
-
         txRollbacks++;
 
         if (delegate != null)
@@ -455,12 +389,6 @@ public class GridCacheMetricsAdapter implements GridCacheMetrics, Externalizable
 
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeLong(createTime);
-        out.writeLong(readTime);
-        out.writeLong(writeTime);
-        out.writeLong(commitTime);
-        out.writeLong(rollbackTime);
-
         out.writeInt(reads);
         out.writeInt(writes);
         out.writeInt(hits);
@@ -477,12 +405,6 @@ public class GridCacheMetricsAdapter implements GridCacheMetrics, Externalizable
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        createTime = in.readLong();
-        readTime = in.readLong();
-        writeTime = in.readLong();
-        commitTime = in.readLong();
-        rollbackTime = in.readLong();
-
         reads = in.readInt();
         writes = in.readInt();
         hits = in.readInt();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProxyImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProxyImpl.java
index ac13deb..0441549 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheProxyImpl.java
@@ -195,7 +195,7 @@ public class GridCacheProxyImpl<K, V> implements GridCacheProxy<K, V>, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public GridCacheMetrics metrics() {
+    @Override public CacheMetricsMxBean metrics() {
         GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
 
         try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheCommandHandler.java
index e8a2a98..b179ea8 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheCommandHandler.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheCommandHandler.java
@@ -1137,13 +1137,16 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
 
         /** {@inheritDoc} */
         @Override public IgniteFuture<?> applyx(GridCacheProjection<Object, Object> c, GridKernalContext ctx) {
-            GridCacheMetrics metrics = c.cache().metrics();
+            CacheMetricsMxBean metrics = c.cache().metrics();
 
             assert metrics != null;
 
             return new GridFinishedFuture<Object>(ctx, new GridCacheRestMetrics(
-                metrics.createTime(), metrics.readTime(), metrics.writeTime(),
-                metrics.reads(), metrics.writes(), metrics.hits(), metrics.misses()));
+                (int)metrics.getCacheGets(),
+                (int)(metrics.getCacheRemovals() + metrics.getCachePuts()),
+                (int)metrics.getCacheHits(),
+                (int)metrics.getCacheMisses())
+            );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheRestMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheRestMetrics.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheRestMetrics.java
index b57cfb4..3c72217 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheRestMetrics.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/cache/GridCacheRestMetrics.java
@@ -25,15 +25,6 @@ import java.util.*;
  * Grid cache metrics for rest.
  */
 public class GridCacheRestMetrics {
-    /** Create time. */
-    private long createTime;
-
-    /** Last read time. */
-    private long readTime;
-
-    /** Last update time. */
-    private long writeTime;
-
     /** Number of reads. */
     private int reads;
 
@@ -49,19 +40,12 @@ public class GridCacheRestMetrics {
     /**
      * Constructor.
      *
-     * @param createTime Create time.
-     * @param readTime Read time.
-     * @param writeTime Write time.
      * @param reads Reads.
      * @param writes Writes.
      * @param hits Hits.
      * @param misses Misses.
      */
-    public GridCacheRestMetrics(long createTime, long readTime, long writeTime, int reads, int writes, int hits,
-        int misses) {
-        this.createTime = createTime;
-        this.readTime = readTime;
-        this.writeTime = writeTime;
+    public GridCacheRestMetrics(int reads, int writes, int hits, int misses) {
         this.reads = reads;
         this.writes = writes;
         this.hits = hits;
@@ -69,60 +53,6 @@ public class GridCacheRestMetrics {
     }
 
     /**
-     * Gets create time.
-     *
-     * @return Create time.
-     */
-    public long getCreateTime() {
-        return createTime;
-    }
-
-    /**
-     * Sets create time.
-     *
-     * @param createTime Create time.
-     */
-    public void setCreateTime(long createTime) {
-        this.createTime = createTime;
-    }
-
-    /**
-     * Gets read time.
-     *
-     * @return Read time.
-     */
-    public long getReadTime() {
-        return readTime;
-    }
-
-    /**
-     * Sets read time.
-     *
-     * @param readTime Read time.
-     */
-    public void setReadTime(long readTime) {
-        this.readTime = readTime;
-    }
-
-    /**
-     * Gets write time.
-     *
-     * @return Write time.
-     */
-    public long getWriteTime() {
-        return writeTime;
-    }
-
-    /**
-     * Sets write time.
-     *
-     * @param writeTime Write time.
-     */
-    public void setWriteTime(long writeTime) {
-        this.writeTime = writeTime;
-    }
-
-    /**
      * Gets reads.
      *
      * @return Reads.
@@ -200,11 +130,8 @@ public class GridCacheRestMetrics {
      * @return Map.
      */
     public Map<String, Long> map() {
-        Map<String, Long> map = new GridLeanMap<>(7);
+        Map<String, Long> map = new GridLeanMap<>(4);
 
-        map.put("createTime", createTime);
-        map.put("readTime", readTime);
-        map.put("writeTime", writeTime);
         map.put("reads", (long)reads);
         map.put("writes", (long)writes);
         map.put("hits", (long)hits);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/main/java/org/gridgain/grid/kernal/visor/cache/VisorCacheMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/cache/VisorCacheMetrics.java b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/cache/VisorCacheMetrics.java
index 8263543..1d82d47 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/cache/VisorCacheMetrics.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/cache/VisorCacheMetrics.java
@@ -23,7 +23,7 @@ import org.gridgain.grid.util.typedef.internal.*;
 import java.io.*;
 
 /**
- * Data transfer object for {@link GridCacheMetrics}.
+ * Data transfer object for {@link org.gridgain.grid.cache.CacheMetricsMxBean}.
  */
 public class VisorCacheMetrics implements Serializable {
     /** */
@@ -100,30 +100,30 @@ public class VisorCacheMetrics implements Serializable {
     public static VisorCacheMetrics from(GridCache c) {
         VisorCacheMetrics cm = new VisorCacheMetrics();
 
-        GridCacheMetrics m = c.metrics();
+        CacheMetricsMxBean m = c.metrics();
 
         cm.size = c.size();
 
-        cm.createTm = m.createTime();
-        cm.writeTm = m.writeTime();
-        cm.readTm = m.readTime();
-        cm.commitTm = m.commitTime();
-        cm.rollbackTm = m.rollbackTime();
-
-        cm.reads = m.reads();
-        cm.writes = m.writes();
-        cm.hits = m.hits();
-        cm.misses = m.misses();
-
-        cm.txCommits = m.txCommits();
-        cm.txRollbacks = m.txRollbacks();
-
-        cm.readsPerSec = perSecond(m.reads(), m.readTime(), m.createTime());
-        cm.writesPerSec = perSecond(m.writes(), m.writeTime(), m.createTime());
-        cm.hitsPerSec = perSecond (m.hits(), m.readTime(), m.createTime());
-        cm.missesPerSec = perSecond(m.misses(), m.readTime(), m.createTime());
-        cm.commitsPerSec = perSecond(m.txCommits(), m.commitTime(), m.createTime());
-        cm.rollbacksPerSec = perSecond(m.txRollbacks(), m.rollbackTime(), m.createTime());
+//        cm.createTm = m.createTime();
+//        cm.writeTm = m.writeTime();
+//        cm.readTm = m.readTime();
+//        cm.commitTm = m.commitTime();
+//        cm.rollbackTm = m.rollbackTime();
+//
+//        cm.reads = m.reads();
+//        cm.writes = m.writes();
+//        cm.hits = m.hits();
+//        cm.misses = m.misses();
+//
+//        cm.txCommits = m.getAverageTxCommitTime();
+//        cm.txRollbacks = m.getAverageTxRollbackTime();
+//
+//        cm.readsPerSec = perSecond(m.reads(), m.readTime(), m.createTime());
+//        cm.writesPerSec = perSecond(m.writes(), m.writeTime(), m.createTime());
+//        cm.hitsPerSec = perSecond (m.hits(), m.readTime(), m.createTime());
+//        cm.missesPerSec = perSecond(m.misses(), m.readTime(), m.createTime());
+//        cm.commitsPerSec = perSecond(m.getAverageTxCommitTime(), m.commitTime(), m.createTime());
+//        cm.rollbacksPerSec = perSecond(m.getAverageTxRollbackTime(), m.rollbackTime(), m.createTime());
 
         cm.qryMetrics = VisorCacheQueryMetrics.from(c.queries().metrics());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/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 c9b2f0e..c347f29 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
@@ -146,7 +146,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         assertTrue(fut.get());
 
-        assert cache.metrics().getAverageRemoveTime() > 0;
+        assert cache.metrics().getAverageRemoveTime() >= 0;
     }
 
     /**
@@ -309,7 +309,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         GridCache<Object, Object> cache = grid(0).cache(null);
 
         assertEquals(0.0, cache.metrics().getAveragePutTime(), 0.0);
-        assertEquals(0, cache.metrics().writes());
+        assertEquals(0, cache.metrics().getCachePuts());
 
         jcache.put(1, 1);
 
@@ -317,7 +317,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         assert avgPutTime >= 0;
 
-        assertEquals(1, cache.metrics().writes());
+        assertEquals(1, cache.metrics().getCachePuts());
 
         jcache.put(2, 2);
 
@@ -433,7 +433,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         GridCache<Object, Object> cache = grid(0).cache(null);
 
         assertEquals(0.0, cache.metrics().getAveragePutTime(), 0.0);
-        assertEquals(0, cache.metrics().writes());
+        assertEquals(0, cache.metrics().getCachePuts());
 
         Map<Integer, Integer> values = new HashMap<>();
 
@@ -446,13 +446,13 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         float averagePutTime = cache.metrics().getAveragePutTime();
 
         assert averagePutTime >= 0;
-        assertEquals(values.size(), cache.metrics().writes());
+        assertEquals(values.size(), cache.metrics().getCachePuts());
     }
 
     /**
      * @throws Exception If failed.
      */
-    public void testWritesReads() throws Exception {
+    public void testPutsReads() throws Exception {
         GridCache<Integer, Integer> cache0 = grid(0).cache(null);
 
         int keyCnt = keyCount();
@@ -462,19 +462,19 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         // Put and get a few keys.
         for (int i = 0; i < keyCnt; i++) {
-            cache0.put(i, i); // +1 read
+            cache0.put(i, i); // +1 put
 
             boolean isPrimary = cache0.affinity().isPrimary(grid(0).localNode(), i);
 
             expReads += expectedReadsPerPut(isPrimary);
             expMisses += expectedMissesPerPut(isPrimary);
 
-            info("Writes: " + cache0.metrics().writes());
+            info("Puts: " + cache0.metrics().getCachePuts());
 
             for (int j = 0; j < gridCount(); j++) {
                 GridCache<Integer, Integer> cache = grid(j).cache(null);
 
-                int cacheWrites = cache.metrics().writes();
+                int cacheWrites = (int)cache.metrics().getCachePuts();
 
                 assertEquals("Wrong cache metrics [i=" + i + ", grid=" + j + ']', i + 1, cacheWrites);
             }
@@ -485,23 +485,23 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         }
 
         // Check metrics for the whole cache.
-        long writes = 0;
-        long reads = 0;
-        long hits = 0;
-        long misses = 0;
+        int puts = 0;
+        int reads = 0;
+        int hits = 0;
+        int misses = 0;
 
         for (int i = 0; i < gridCount(); i++) {
-            GridCacheMetrics m = grid(i).cache(null).metrics();
+            CacheMetricsMxBean m = grid(i).cache(null).metrics();
 
-            writes += m.writes();
-            reads += m.reads();
-            hits += m.hits();
-            misses += m.misses();
+            puts += m.getCachePuts();
+            reads += m.getCacheGets();
+            hits += m.getCacheHits();
+            misses += m.getCacheMisses();
         }
 
         info("Stats [reads=" + reads + ", hits=" + hits + ", misses=" + misses + ']');
 
-        assertEquals(keyCnt * gridCount(), writes);
+        assertEquals(keyCnt * gridCount(), puts);
         assertEquals(expReads, reads);
         assertEquals(keyCnt, hits);
         assertEquals(expMisses, misses);
@@ -519,12 +519,12 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         for (int i = 0; i < keyCnt; i++) {
             cache0.put(i, i); // +1 read
 
-            info("Writes: " + cache0.metrics().writes());
+            info("Puts: " + cache0.metrics().getCachePuts());
 
             for (int j = 0; j < gridCount(); j++) {
                 GridCache<Integer, Integer> cache = grid(j).cache(null);
 
-                int cacheWrites = cache.metrics().writes();
+                long cacheWrites = cache.metrics().getCachePuts();
 
                 assertEquals("Wrong cache metrics [i=" + i + ", grid=" + j + ']', i + 1, cacheWrites);
             }
@@ -534,7 +534,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         // Check metrics for the whole cache.
         for (int i = 0; i < gridCount(); i++) {
-            GridCacheMetrics m = grid(i).cache(null).metrics();
+            CacheMetricsMxBean m = grid(i).cache(null).metrics();
 
             assertEquals(m.getCacheHits() * 100f / m.getCacheGets(), m.getCacheHitPercentage(), 0.1f);
             assertEquals(m.getCacheMisses() * 100f / m.getCacheGets(), m.getCacheMissPercentage(), 0.1f);
@@ -563,21 +563,21 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         }
 
         // Check metrics for the whole cache.
-        long writes = 0;
+        long puts = 0;
         long reads = 0;
         long hits = 0;
         long misses = 0;
 
         for (int i = 0; i < gridCount(); i++) {
-            GridCacheMetrics m = grid(i).cache(null).metrics();
+            CacheMetricsMxBean m = grid(i).cache(null).metrics();
 
-            writes += m.writes();
-            reads += m.reads();
-            hits += m.hits();
-            misses += m.misses();
+            puts += m.getCachePuts();
+            reads += m.getCacheGets();
+            hits += m.getCacheHits();
+            misses += m.getCacheMisses();
         }
 
-        assertEquals(0, writes);
+        assertEquals(0, puts);
         assertEquals(expReads, reads);
         assertEquals(0, hits);
         assertEquals(expReads, misses);
@@ -589,8 +589,8 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testMissesOnEmptyCache() throws Exception {
         GridCache<Integer, Integer> cache = grid(0).cache(null);
 
-        assertEquals("Expected 0 read", 0, cache.metrics().reads());
-        assertEquals("Expected 0 miss", 0, cache.metrics().misses());
+        assertEquals("Expected 0 read", 0, cache.metrics().getCacheGets());
+        assertEquals("Expected 0 miss", 0, cache.metrics().getCacheMisses());
 
         Integer key =  null;
 
@@ -606,17 +606,17 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         cache.get(key);
 
-        assertEquals("Expected 1 read", 1, cache.metrics().reads());
-        assertEquals("Expected 1 miss", 1, cache.metrics().misses());
+        assertEquals("Expected 1 read", 1, cache.metrics().getCacheGets());
+        assertEquals("Expected 1 miss", 1, cache.metrics().getCacheMisses());
 
         cache.put(key, key); // +1 read, +1 miss.
 
         cache.get(key);
 
-        assertEquals("Expected 1 write", 1, cache.metrics().writes());
-        assertEquals("Expected 3 reads", 3, cache.metrics().reads());
-        assertEquals("Expected 2 misses", 2, cache.metrics().misses());
-        assertEquals("Expected 1 hit", 1, cache.metrics().hits());
+        assertEquals("Expected 1 write", 1, cache.metrics().getCachePuts());
+        assertEquals("Expected 3 reads", 3, cache.metrics().getCacheGets());
+        assertEquals("Expected 2 misses", 2, cache.metrics().getCacheMisses());
+        assertEquals("Expected 1 hit", 1, cache.metrics().getCacheHits());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
index 69ec4b4..1e0b38c 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
@@ -220,21 +220,21 @@ public abstract class GridCacheTransactionalAbstractMetricsSelfTest extends Grid
 
         for (int i = 0; i < gridCount(); i++) {
             IgniteTxMetrics metrics = grid(i).transactions().metrics();
-            GridCacheMetrics cacheMetrics = grid(i).cache(null).metrics();
+            CacheMetricsMxBean cacheMetrics = grid(i).cache(null).metrics();
 
             if (i == 0) {
                 assertEquals(TX_CNT, metrics.txCommits());
 
                 if (put)
-                    assertEquals(TX_CNT, cacheMetrics.txCommits());
+                    assertEquals(TX_CNT, cacheMetrics.getCacheTxCommits());
             }
             else {
                 assertEquals(0, metrics.txCommits());
-                assertEquals(0, cacheMetrics.txCommits());
+                assertEquals(0, cacheMetrics.getCacheTxCommits());
             }
 
             assertEquals(0, metrics.txRollbacks());
-            assertEquals(0, cacheMetrics.txRollbacks());
+            assertEquals(0, cacheMetrics.getCacheTxRollbacks());
         }
     }
 
@@ -260,20 +260,20 @@ public abstract class GridCacheTransactionalAbstractMetricsSelfTest extends Grid
 
         for (int i = 0; i < gridCount(); i++) {
             IgniteTxMetrics metrics = grid(i).transactions().metrics();
-            GridCacheMetrics cacheMetrics = grid(i).cache(null).metrics();
+            CacheMetricsMxBean cacheMetrics = grid(i).cache(null).metrics();
 
             assertEquals(0, metrics.txCommits());
-            assertEquals(0, cacheMetrics.txCommits());
+            assertEquals(0, cacheMetrics.getCacheTxCommits());
 
             if (i == 0) {
                 assertEquals(TX_CNT, metrics.txRollbacks());
 
                 if (put)
-                    assertEquals(TX_CNT, cacheMetrics.txRollbacks());
+                    assertEquals(TX_CNT, cacheMetrics.getCacheTxRollbacks());
             }
             else {
                 assertEquals(0, metrics.txRollbacks());
-                assertEquals(0, cacheMetrics.txRollbacks());
+                assertEquals(0, cacheMetrics.getCacheTxRollbacks());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java
index b699ce6..8b76feb 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java
@@ -97,21 +97,21 @@ public class GridCachePartitionedNearDisabledMetricsSelfTest extends GridCacheAb
         assertNull("Value is not null for key: " + 0, cache.get(0));
 
         // Check metrics for the whole cache.
-        long writes = 0;
+        long removes = 0;
         long reads = 0;
         long hits = 0;
         long misses = 0;
 
         for (int i = 0; i < gridCount(); i++) {
-            GridCacheMetrics m = grid(i).cache(null).metrics();
+            CacheMetricsMxBean m = grid(i).cache(null).metrics();
 
-            writes += m.writes();
-            reads += m.reads();
-            hits += m.hits();
-            misses += m.misses();
+            removes += m.getCacheRemovals();
+            reads += m.getCacheGets();
+            hits += m.getCacheHits();
+            misses += m.getCacheMisses();
         }
 
-        assertEquals(0, writes);
+        assertEquals(0, removes);
         assertEquals(1, reads);
         assertEquals(0, hits);
         assertEquals(1, misses);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
index 0e1b41e..28e7eb5 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
@@ -113,8 +113,8 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
 
                 key = i;
 
-                info("Writes: " + cache0.metrics().writes());
-                info("Reads: " + cache0.metrics().reads());
+                info("Puts: " + cache0.metrics().getCachePuts());
+                info("Reads: " + cache0.metrics().getCacheGets());
                 info("Affinity nodes: " + U.nodes2names(cache0.affinity().mapKeyToPrimaryAndBackups(i)));
 
                 break;
@@ -126,23 +126,23 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
 
             info("Checking grid: " + g.name());
 
-            info("Writes: " + g.cache(null).metrics().writes());
-            info("Reads: " + g.cache(null).metrics().reads());
+            info("Puts: " + g.cache(null).metrics().getCachePuts());
+            info("Reads: " + g.cache(null).metrics().getCacheGets());
 
             if (g.cache(null).affinity().isPrimaryOrBackup(g.cluster().localNode(), key))
-                assertEquals(1, g.cache(null).metrics().writes());
+                assertEquals(1, g.cache(null).metrics().getCachePuts());
             else
-                assertEquals(0, g.cache(null).metrics().writes());
+                assertEquals(0, g.cache(null).metrics().getCachePuts());
 
             if (g.cache(null).affinity().isPrimary(g.cluster().localNode(), key)) {
-                assertEquals(2, g.cache(null).metrics().reads());
-                assertEquals(1, g.cache(null).metrics().hits());
-                assertEquals(1, g.cache(null).metrics().misses());
+                assertEquals(2, g.cache(null).metrics().getCacheGets());
+                assertEquals(1, g.cache(null).metrics().getCacheHits());
+                assertEquals(1, g.cache(null).metrics().getCacheHits());
             }
             else {
-                assertEquals(0, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(0, g.cache(null).metrics().misses());
+                assertEquals(0, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(0, g.cache(null).metrics().getCacheMisses());
             }
         }
     }
@@ -166,8 +166,8 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
 
                 key = i;
 
-                info("Writes: " + cache0.metrics().writes());
-                info("Reads: " + cache0.metrics().reads());
+                info("Puts: " + cache0.metrics().getCachePuts());
+                info("Reads: " + cache0.metrics().getCacheGets());
                 info("Affinity nodes: " + U.nodes2names(cache0.affinity().mapKeyToPrimaryAndBackups(i)));
 
                 break;
@@ -178,24 +178,24 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
             Ignite g = grid(j);
 
             if (g.cache(null).affinity().isPrimaryOrBackup(g.cluster().localNode(), key))
-                assertEquals(1, g.cache(null).metrics().writes());
+                assertEquals(1, g.cache(null).metrics().getCachePuts());
             else
-                assertEquals(0, g.cache(null).metrics().writes());
+                assertEquals(0, g.cache(null).metrics().getCachePuts());
 
             if (g.cache(null).affinity().isPrimary(g.cluster().localNode(), key)) {
-                assertEquals(1, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(1, g.cache(null).metrics().misses());
+                assertEquals(1, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(1, g.cache(null).metrics().getCacheMisses());
             }
             else if (g.cache(null).affinity().isBackup(g.cluster().localNode(), key)){
-                assertEquals(2, g.cache(null).metrics().reads());
-                assertEquals(1, g.cache(null).metrics().hits());
-                assertEquals(1, g.cache(null).metrics().misses());
+                assertEquals(2, g.cache(null).metrics().getCacheGets());
+                assertEquals(1, g.cache(null).metrics().getCacheHits());
+                assertEquals(1, g.cache(null).metrics().getCacheMisses());
             }
             else {
-                assertEquals(0, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(0, g.cache(null).metrics().misses());
+                assertEquals(0, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(0, g.cache(null).metrics().getCacheMisses());
             }
         }
     }
@@ -219,8 +219,8 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
 
                 key = i;
 
-                info("Writes: " + cache0.metrics().writes());
-                info("Reads: " + cache0.metrics().reads());
+                info("Writes: " + cache0.metrics().getCachePuts());
+                info("Reads: " + cache0.metrics().getCacheGets());
                 info("Affinity nodes: " + U.nodes2names(cache0.affinity().mapKeyToPrimaryAndBackups(i)));
 
                 break;
@@ -230,22 +230,22 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
         for (int j = 0; j < gridCount(); j++) {
             Ignite g = grid(j);
 
-            assertEquals(1, g.cache(null).metrics().writes());
+            assertEquals(1, g.cache(null).metrics().getCachePuts());
 
             if (g.cache(null).affinity().isPrimary(g.cluster().localNode(), key)) {
-                assertEquals(1, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(1, g.cache(null).metrics().misses());
+                assertEquals(1, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(1, g.cache(null).metrics().getCacheMisses());
             }
             else if (g.cache(null).affinity().isBackup(g.cluster().localNode(), key)){
-                assertEquals(0, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(0, g.cache(null).metrics().misses());
+                assertEquals(0, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(0, g.cache(null).metrics().getCacheMisses());
             }
             else {
-                assertEquals(2, g.cache(null).metrics().reads());
-                assertEquals(1, g.cache(null).metrics().hits());
-                assertEquals(1, g.cache(null).metrics().misses());
+                assertEquals(2, g.cache(null).metrics().getCacheGets());
+                assertEquals(1, g.cache(null).metrics().getCacheHits());
+                assertEquals(1, g.cache(null).metrics().getCacheMisses());
             }
         }
     }
@@ -267,14 +267,14 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
 
                 key = i;
 
-                info("Writes: " + cache0.metrics().writes());
-                info("Reads: " + cache0.metrics().reads());
+                info("Writes: " + cache0.metrics().getCachePuts());
+                info("Reads: " + cache0.metrics().getCacheGets());
                 info("Affinity nodes: " + U.nodes2names(cache0.affinity().mapKeyToPrimaryAndBackups(i)));
 
                 cache0.get(i); // +1 read.
 
-                info("Writes: " + cache0.metrics().writes());
-                info("Reads: " + cache0.metrics().reads());
+                info("Writes: " + cache0.metrics().getCachePuts());
+                info("Reads: " + cache0.metrics().getCacheGets());
                 info("Affinity nodes: " + U.nodes2names(cache0.affinity().mapKeyToPrimaryAndBackups(i)));
 
                 break;
@@ -286,20 +286,20 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
 
             info("Checking grid: " + g.name());
 
-            info("Writes: " + g.cache(null).metrics().writes());
-            info("Reads: " + g.cache(null).metrics().reads());
+            info("Writes: " + g.cache(null).metrics().getCachePuts());
+            info("Reads: " + g.cache(null).metrics().getCacheGets());
 
-            assertEquals(0, g.cache(null).metrics().writes());
+            assertEquals(0, g.cache(null).metrics().getCachePuts());
 
             if (g.cache(null).affinity().isPrimary(g.cluster().localNode(), key)) {
-                assertEquals(2, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(2, g.cache(null).metrics().misses());
+                assertEquals(2, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(2, g.cache(null).metrics().getCacheMisses());
             }
             else {
-                assertEquals(0, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(0, g.cache(null).metrics().misses());
+                assertEquals(0, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(0, g.cache(null).metrics().getCacheMisses());
             }
         }
     }
@@ -321,14 +321,14 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
 
                 key = i;
 
-                info("Writes: " + cache0.metrics().writes());
-                info("Reads: " + cache0.metrics().reads());
+                info("Writes: " + cache0.metrics().getCachePuts());
+                info("Reads: " + cache0.metrics().getCacheGets());
                 info("Affinity nodes: " + U.nodes2names(cache0.affinity().mapKeyToPrimaryAndBackups(i)));
 
                 cache0.get(i); // +1 read.
 
-                info("Writes: " + cache0.metrics().writes());
-                info("Reads: " + cache0.metrics().reads());
+                info("Writes: " + cache0.metrics().getCachePuts());
+                info("Reads: " + cache0.metrics().getCacheGets());
                 info("Affinity nodes: " + U.nodes2names(cache0.affinity().mapKeyToPrimaryAndBackups(i)));
 
                 break;
@@ -338,17 +338,17 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
         for (int j = 0; j < gridCount(); j++) {
             Ignite g = grid(j);
 
-            assertEquals(0, g.cache(null).metrics().writes());
+            assertEquals(0, g.cache(null).metrics().getCachePuts());
 
             if (g.cache(null).affinity().isPrimaryOrBackup(g.cluster().localNode(), key)) {
-                assertEquals(2, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(2, g.cache(null).metrics().misses());
+                assertEquals(2, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(2, g.cache(null).metrics().getCacheMisses());
             }
             else {
-                assertEquals(0, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(0, g.cache(null).metrics().misses());
+                assertEquals(0, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(0, g.cache(null).metrics().getCacheMisses());
             }
         }
     }
@@ -371,10 +371,10 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
 
                 key = i;
 
-                info("Writes: " + cache0.metrics().writes());
-                info("Reads: " + cache0.metrics().reads());
-                info("Hits: " + cache0.metrics().hits());
-                info("Misses: " + cache0.metrics().misses());
+                info("Writes: " + cache0.metrics().getCachePuts());
+                info("Reads: " + cache0.metrics().getCacheGets());
+                info("Hits: " + cache0.metrics().getCacheHits());
+                info("Misses: " + cache0.metrics().getCacheMisses());
                 info("Affinity nodes: " + U.nodes2names(cache0.affinity().mapKeyToPrimaryAndBackups(i)));
 
                 break;
@@ -384,22 +384,22 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
         for (int j = 0; j < gridCount(); j++) {
             Ignite g = grid(j);
 
-            assertEquals(0, g.cache(null).metrics().writes());
+            assertEquals(0, g.cache(null).metrics().getCachePuts());
 
             if (g.cache(null).affinity().isPrimary(g.cluster().localNode(), key)) {
-                assertEquals(2, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(2, g.cache(null).metrics().misses());
+                assertEquals(2, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(2, g.cache(null).metrics().getCacheMisses());
             }
             else if (g.cache(null).affinity().isBackup(g.cluster().localNode(), key)){
-                assertEquals(0, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(0, g.cache(null).metrics().misses());
+                assertEquals(0, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(0, g.cache(null).metrics().getCacheMisses());
             }
             else {
-                assertEquals(2, g.cache(null).metrics().reads());
-                assertEquals(0, g.cache(null).metrics().hits());
-                assertEquals(2, g.cache(null).metrics().misses());
+                assertEquals(2, g.cache(null).metrics().getCacheGets());
+                assertEquals(0, g.cache(null).metrics().getCacheHits());
+                assertEquals(2, g.cache(null).metrics().getCacheMisses());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea7f5252/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java
index 9eefa86..9c16f53 100644
--- a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java
+++ b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java
@@ -121,10 +121,10 @@ public class GridCachePartitionedHitsAndMissesSelfTest extends GridCommonAbstrac
             long misses = 0;
 
             for (int i = 0; i < GRID_CNT; i++) {
-                GridCacheMetrics m = grid(i).cache(null).metrics();
+                CacheMetricsMxBean m = grid(i).cache(null).metrics();
 
-                hits += m.hits();
-                misses += m.misses();
+                hits += m.getCacheHits();
+                misses += m.getCacheMisses();
             }
 
             assertEquals(CNT / 2, hits);


Mime
View raw message