ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [2/3] incubator-ignite git commit: IGNITE-49 TEMP
Date Fri, 23 Jan 2015 13:08:21 GMT
IGNITE-49 TEMP


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

Branch: refs/heads/ignite-49
Commit: e4288e320e743f02d0a053ae8b112d5e5045641e
Parents: 669f3a9
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Fri Jan 23 15:10:44 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Fri Jan 23 15:10:44 2015 +0300

----------------------------------------------------------------------
 .../integration/GridClientAbstractSelfTest.java |   4 +-
 .../rest/GridRestBinaryProtocolSelfTest.java    |   4 +-
 .../rest/GridRestMemcacheProtocolSelfTest.java  |   4 +-
 .../org/gridgain/grid/cache/CacheMetrics.java   | 238 ++++++++
 .../gridgain/grid/cache/IgniteCacheMxBean.java  | 206 ++-----
 .../processors/cache/CacheMetricsAdapter.java   | 554 +++++++++++++++++++
 .../processors/cache/CacheMetricsImpl.java      | 370 -------------
 .../processors/cache/CacheMetricsSnapshot.java  | 160 ++++++
 .../processors/cache/GridCacheAdapter.java      |  20 +-
 .../cache/distributed/dht/GridDhtCache.java     |   2 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   2 +-
 .../local/atomic/GridLocalAtomicCache.java      |   6 +-
 12 files changed, 1005 insertions(+), 565 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/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 a14aac4..fc47464 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
@@ -942,8 +942,8 @@ public abstract class GridClientAbstractSelfTest extends GridCommonAbstractTest
         GridClientData dfltData = client.data();
         GridClientData namedData = client.data(CACHE_NAME);
 
-        grid().cache(null).metrics().clear();
-        grid().cache(CACHE_NAME).metrics().clear();
+        grid().cache(null).mxBean().clear();
+        grid().cache(CACHE_NAME).mxBean().clear();
 
         grid().cache(null).putx("key1", "val1");
         grid().cache(null).putx("key2", "val2");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/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 7fe5a93..c0878e3 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
@@ -381,8 +381,8 @@ public class GridRestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testMetrics() throws Exception {
-        grid().cache(null).metrics().clear();
-        grid().cache(CACHE_NAME).metrics().clear();
+        grid().cache(null).mxBean().clear();
+        grid().cache(CACHE_NAME).mxBean().clear();
 
         grid().cache(null).putx("key1", "val");
         grid().cache(null).putx("key2", "val");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/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 30addf4..a260b6f 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
@@ -205,8 +205,8 @@ public class GridRestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testMetrics() throws Exception {
-        grid().cache(null).metrics().clear();
-        grid().cache(CACHE_NAME).metrics().clear();
+        grid().cache(null).mxBean().clear();
+        grid().cache(CACHE_NAME).mxBean().clear();
 
         grid().cache(null).putx("key1", "val");
         grid().cache(null).putx("key2", "val");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetrics.java b/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetrics.java
index 1713b8f..9810e1c 100644
--- a/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetrics.java
+++ b/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetrics.java
@@ -18,6 +18,7 @@
 package org.gridgain.grid.cache;
 
 import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
 
 /**
  * Cache metrics used to obtain statistics on cache itself.
@@ -135,4 +136,241 @@ public interface CacheMetrics {
      * @return Number of transaction rollbacks.
      */
     public long getCacheTxRollbacks();
+
+    /**
+     * Gets name of this cache.
+     *
+     * @return Cache name.
+     */
+    public String name();
+
+    /**
+     * Gets metrics (statistics) for this cache.
+     *
+     * @return Cache metrics.
+     */
+    public String metricsFormatted();
+
+    /**
+     * Gets number of entries that was swapped to disk.
+     *
+     * @return Number of entries that was swapped to disk.
+     */
+    public long getOverflowSize();
+
+    /**
+     * Gets number of entries stored in off-heap memory.
+     *
+     * @return Number of entries stored in off-heap memory.
+     */
+    public long getOffHeapEntriesCount();
+
+    /**
+     * Gets memory size allocated in off-heap.
+     *
+     * @return Memory size allocated in off-heap.
+     */
+    public long getOffHeapAllocatedSize();
+
+    /**
+     * Returns number of non-{@code null} values in the cache.
+     *
+     * @return Number of non-{@code null} values in the cache.
+     */
+    public int getSize();
+
+    /**
+     * Gets number of keys in the cache, possibly with {@code null} values.
+     *
+     * @return Number of keys in the cache.
+     */
+    public int getKeySize();
+
+    /**
+     * Returns {@code true} if this cache is empty.
+     *
+     * @return {@code true} if this cache is empty.
+     */
+    public boolean isEmpty();
+
+    /**
+     * Gets current size of evict queue used to batch up evictions.
+     *
+     * @return Current size of evict queue.
+     */
+    public int getDhtEvictQueueCurrentSize();
+
+    /**
+     * Gets transaction per-thread map size.
+     *
+     * @return Thread map size.
+     */
+    public int getTxThreadMapSize();
+
+    /**
+     * Gets transaction per-Xid map size.
+     *
+     * @return Transaction per-Xid map size.
+     */
+    public int getTxXidMapSize();
+
+    /**
+     * Gets committed transaction queue size.
+     *
+     * @return Committed transaction queue size.
+     */
+    public int getTxCommitQueueSize();
+
+    /**
+     * Gets prepared transaction queue size.
+     *
+     * @return Prepared transaction queue size.
+     */
+    public int getTxPrepareQueueSize();
+
+    /**
+     * Gets start version counts map size.
+     *
+     * @return Start version counts map size.
+     */
+    public int getTxStartVersionCountsSize();
+
+    /**
+     * Gets number of cached committed transaction IDs.
+     *
+     * @return Number of cached committed transaction IDs.
+     */
+    public int getTxCommittedVersionsSize();
+
+    /**
+     * Gets number of cached rolled back transaction IDs.
+     *
+     * @return Number of cached rolled back transaction IDs.
+     */
+    public int getTxRolledbackVersionsSize();
+
+    /**
+     * Gets transaction DHT per-thread map size.
+     *
+     * @return DHT thread map size.
+     */
+    public int getTxDhtThreadMapSize();
+
+    /**
+     * Gets transaction DHT per-Xid map size.
+     *
+     * @return Transaction DHT per-Xid map size.
+     */
+    public int getTxDhtXidMapSize();
+
+    /**
+     * Gets committed DHT transaction queue size.
+     *
+     * @return Committed DHT transaction queue size.
+     */
+    public int getTxDhtCommitQueueSize();
+
+    /**
+     * Gets prepared DHT transaction queue size.
+     *
+     * @return Prepared DHT transaction queue size.
+     */
+    public int getTxDhtPrepareQueueSize();
+
+    /**
+     * Gets DHT start version counts map size.
+     *
+     * @return DHT start version counts map size.
+     */
+    public int getTxDhtStartVersionCountsSize();
+
+    /**
+     * Gets number of cached committed DHT transaction IDs.
+     *
+     * @return Number of cached committed DHT transaction IDs.
+     */
+    public int getTxDhtCommittedVersionsSize();
+
+    /**
+     * Gets number of cached rolled back DHT transaction IDs.
+     *
+     * @return Number of cached rolled back DHT transaction IDs.
+     */
+    public int getTxDhtRolledbackVersionsSize();
+
+    /**
+     * Returns {@code True} if write-behind is enabled.
+     *
+     * @return {@code True} if write-behind is enabled.
+     */
+    public boolean isWriteBehindEnabled();
+
+    /**
+     * Gets the maximum size of the write-behind buffer. When the count of unique keys
+     * in write buffer exceeds this value, the buffer is scheduled for write to the underlying store.
+     * <p/>
+     * If this value is {@code 0}, then flush is performed only on time-elapsing basis. However,
+     * when this value is {@code 0}, the cache critical size is set to
+     * {@link CacheConfiguration#DFLT_WRITE_BEHIND_CRITICAL_SIZE}
+     *
+     * @return Buffer size that triggers flush procedure.
+     */
+    public int getWriteBehindFlushSize();
+
+    /**
+     * Gets the number of flush threads that will perform store update operations.
+     *
+     * @return Count of worker threads.
+     */
+    public int getWriteBehindFlushThreadCount();
+
+    /**
+     * Gets the cache flush frequency. All pending operations on the underlying store will be performed
+     * within time interval not less then this value.
+     * <p/>
+     * If this value is {@code 0}, then flush is performed only when buffer size exceeds flush size.
+     *
+     * @return Flush frequency in milliseconds.
+     */
+    public long getWriteBehindFlushFrequency();
+
+    /**
+     * Gets the maximum count of similar (put or remove) operations that can be grouped to a single batch.
+     *
+     * @return Maximum size of batch.
+     */
+    public int getWriteBehindStoreBatchSize();
+
+    /**
+     * Gets count of write buffer overflow events since initialization. Each overflow event causes
+     * the ongoing flush operation to be performed synchronously.
+     *
+     * @return Count of cache overflow events since start.
+     */
+    public int getWriteBehindTotalCriticalOverflowCount();
+
+    /**
+     * Gets count of write buffer overflow events in progress at the moment. Each overflow event causes
+     * the ongoing flush operation to be performed synchronously.
+     *
+     * @return Count of cache overflow events since start.
+     */
+    public int getWriteBehindCriticalOverflowCount();
+
+    /**
+     * Gets count of cache entries that are in a store-retry state. An entry is assigned a store-retry state
+     * when underlying store failed due some reason and cache has enough space to retain this entry till
+     * the next try.
+     *
+     * @return Count of entries in store-retry state.
+     */
+    public int getWriteBehindErrorRetryCount();
+
+    /**
+     * Gets count of entries that were processed by the write-behind store and have not been
+     * flushed to the underlying store yet.
+     *
+     * @return Total count of entries in cache store internal buffer.
+     */
+    public int getWriteBehindBufferSize();
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/modules/core/src/main/java/org/gridgain/grid/cache/IgniteCacheMxBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/IgniteCacheMxBean.java b/modules/core/src/main/java/org/gridgain/grid/cache/IgniteCacheMxBean.java
index 6e4b134..9f40264 100644
--- a/modules/core/src/main/java/org/gridgain/grid/cache/IgniteCacheMxBean.java
+++ b/modules/core/src/main/java/org/gridgain/grid/cache/IgniteCacheMxBean.java
@@ -17,7 +17,6 @@
 
 package org.gridgain.grid.cache;
 
-import org.apache.ignite.cache.CacheConfiguration;
 import org.apache.ignite.mbean.*;
 
 import javax.cache.management.CacheStatisticsMXBean;
@@ -91,272 +90,131 @@ public interface IgniteCacheMxBean extends CacheStatisticsMXBean, CacheMetrics {
     @IgniteMBeanDescription("Number of transaction rollback.")
     public long getCacheTxRollbacks();
 
-    /**
-     * Gets name of this cache.
-     *
-     * @return Cache name.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Cache name.")
     public String name();
 
-    /**
-     * Gets metrics (statistics) for this cache.
-     *
-     * @return Cache metrics.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Formatted cache metrics.")
     public String metricsFormatted();
 
-    /**
-     * Gets number of entries that was swapped to disk.
-     *
-     * @return Number of entries that was swapped to disk.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Number of entries that was swapped to disk.")
     public long getOverflowSize();
 
-    /**
-     * Gets number of entries stored in off-heap memory.
-     *
-     * @return Number of entries stored in off-heap memory.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Number of entries stored in off-heap memory.")
     public long getOffHeapEntriesCount();
 
-    /**
-     * Gets memory size allocated in off-heap.
-     *
-     * @return Memory size allocated in off-heap.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Memory size allocated in off-heap.")
     public long getOffHeapAllocatedSize();
 
-    /**
-     * Returns number of non-{@code null} values in the cache.
-     *
-     * @return Number of non-{@code null} values in the cache.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Number of non-null values in the cache.")
     public int getSize();
 
-    /**
-     * Gets number of keys in the cache, possibly with {@code null} values.
-     *
-     * @return Number of keys in the cache.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Number of keys in the cache (possibly with null values).")
     public int getKeySize();
 
-    /**
-     * Returns {@code true} if this cache is empty.
-     *
-     * @return {@code true} if this cache is empty.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("True if cache is empty.")
     public boolean isEmpty();
 
-    /**
-     * Gets current size of evict queue used to batch up evictions.
-     *
-     * @return Current size of evict queue.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Current size of evict queue.")
     public int getDhtEvictQueueCurrentSize();
 
-    /**
-     * Gets transaction per-thread map size.
-     *
-     * @return Thread map size.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction per-thread map size.")
     public int getTxThreadMapSize();
 
-    /**
-     * Gets transaction per-Xid map size.
-     *
-     * @return Transaction per-Xid map size.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction per-Xid map size.")
     public int getTxXidMapSize();
 
-    /**
-     * Gets committed transaction queue size.
-     *
-     * @return Committed transaction queue size.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction committed queue size.")
     public int getTxCommitQueueSize();
 
-    /**
-     * Gets prepared transaction queue size.
-     *
-     * @return Prepared transaction queue size.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction prepared queue size.")
     public int getTxPrepareQueueSize();
 
-    /**
-     * Gets start version counts map size.
-     *
-     * @return Start version counts map size.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction start version counts map size.")
     public int getTxStartVersionCountsSize();
 
-    /**
-     * Gets number of cached committed transaction IDs.
-     *
-     * @return Number of cached committed transaction IDs.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction committed ID map size.")
     public int getTxCommittedVersionsSize();
 
-    /**
-     * Gets number of cached rolled back transaction IDs.
-     *
-     * @return Number of cached rolled back transaction IDs.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction rolled back ID map size.")
     public int getTxRolledbackVersionsSize();
 
-    /**
-     * Gets transaction DHT per-thread map size.
-     *
-     * @return DHT thread map size.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction DHT per-thread map size.")
     public int getTxDhtThreadMapSize();
 
-    /**
-     * Gets transaction DHT per-Xid map size.
-     *
-     * @return Transaction DHT per-Xid map size.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction DHT per-Xid map size.")
     public int getTxDhtXidMapSize();
 
-    /**
-     * Gets committed DHT transaction queue size.
-     *
-     * @return Committed DHT transaction queue size.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction DHT committed queue size.")
     public int getTxDhtCommitQueueSize();
 
-    /**
-     * Gets prepared DHT transaction queue size.
-     *
-     * @return Prepared DHT transaction queue size.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction DHT prepared queue size.")
     public int getTxDhtPrepareQueueSize();
 
-    /**
-     * Gets DHT start version counts map size.
-     *
-     * @return DHT start version counts map size.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction DHT start version counts map size.")
     public int getTxDhtStartVersionCountsSize();
 
-    /**
-     * Gets number of cached committed DHT transaction IDs.
-     *
-     * @return Number of cached committed DHT transaction IDs.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction DHT committed ID map size.")
     public int getTxDhtCommittedVersionsSize();
 
-    /**
-     * Gets number of cached rolled back DHT transaction IDs.
-     *
-     * @return Number of cached rolled back DHT transaction IDs.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Transaction DHT rolled back ID map size.")
     public int getTxDhtRolledbackVersionsSize();
 
-    /**
-     * Returns {@code True} if write-behind is enabled.
-     *
-     * @return {@code True} if write-behind is enabled.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("True if write-behind is enabled for this cache.")
     public boolean isWriteBehindEnabled();
 
-    /**
-     * Gets the maximum size of the write-behind buffer. When the count of unique keys
-     * in write buffer exceeds this value, the buffer is scheduled for write to the underlying store.
-     * <p/>
-     * If this value is {@code 0}, then flush is performed only on time-elapsing basis. However,
-     * when this value is {@code 0}, the cache critical size is set to
-     * {@link CacheConfiguration#DFLT_WRITE_BEHIND_CRITICAL_SIZE}
-     *
-     * @return Buffer size that triggers flush procedure.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Size of internal buffer that triggers flush procedure.")
     public int getWriteBehindFlushSize();
 
-    /**
-     * Gets the number of flush threads that will perform store update operations.
-     *
-     * @return Count of worker threads.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Count of flush threads.")
     public int getWriteBehindFlushThreadCount();
 
-    /**
-     * Gets the cache flush frequency. All pending operations on the underlying store will be performed
-     * within time interval not less then this value.
-     * <p/>
-     * If this value is {@code 0}, then flush is performed only when buffer size exceeds flush size.
-     *
-     * @return Flush frequency in milliseconds.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Flush frequency interval in milliseconds.")
     public long getWriteBehindFlushFrequency();
 
-    /**
-     * Gets the maximum count of similar (put or remove) operations that can be grouped to a single batch.
-     *
-     * @return Maximum size of batch.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Maximum size of batch for similar operations.")
     public int getWriteBehindStoreBatchSize();
 
-    /**
-     * Gets count of write buffer overflow events since initialization. Each overflow event causes
-     * the ongoing flush operation to be performed synchronously.
-     *
-     * @return Count of cache overflow events since start.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Count of cache overflow events since write-behind cache has started.")
     public int getWriteBehindTotalCriticalOverflowCount();
 
-    /**
-     * Gets count of write buffer overflow events in progress at the moment. Each overflow event causes
-     * the ongoing flush operation to be performed synchronously.
-     *
-     * @return Count of cache overflow events since start.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Count of cache overflow events since write-behind cache has started.")
     public int getWriteBehindCriticalOverflowCount();
 
-    /**
-     * Gets count of cache entries that are in a store-retry state. An entry is assigned a store-retry state
-     * when underlying store failed due some reason and cache has enough space to retain this entry till
-     * the next try.
-     *
-     * @return Count of entries in store-retry state.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Count of cache cache entries that are currently in retry state.")
     public int getWriteBehindErrorRetryCount();
 
-    /**
-     * Gets count of entries that were processed by the write-behind store and have not been
-     * flushed to the underlying store yet.
-     *
-     * @return Total count of entries in cache store internal buffer.
-     */
+    /** {@inheritDoc} */
     @IgniteMBeanDescription("Count of cache entries that are waiting to be flushed.")
     public int getWriteBehindBufferSize();
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsAdapter.java
new file mode 100644
index 0000000..cf342a3
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsAdapter.java
@@ -0,0 +1,554 @@
+/*
+ * 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.kernal.processors.cache;
+
+import org.apache.ignite.*;
+import org.gridgain.grid.cache.*;
+import org.gridgain.grid.util.tostring.*;
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.util.concurrent.atomic.*;
+
+/**
+ * Adapter for cache metrics.
+ */
+public class CacheMetricsAdapter implements CacheMetrics {
+    /** */
+    private static final long NANOS_IN_MICROSECOND = 1000L;
+
+    /** Number of reads. */
+    private AtomicLong reads = new AtomicLong();
+
+    /** Number of writes. */
+    private AtomicLong writes = new AtomicLong();
+
+    /** Number of hits. */
+    private AtomicLong hits = new AtomicLong();
+
+    /** Number of misses. */
+    private AtomicLong misses = new AtomicLong();
+
+    /** Number of transaction commits. */
+    private AtomicLong txCommits = new AtomicLong();
+
+    /** Number of transaction rollbacks. */
+    private AtomicLong txRollbacks = new AtomicLong();
+
+    /** Number of evictions. */
+    private AtomicLong evictCnt = new AtomicLong();
+
+    /** Number of removed entries. */
+    private AtomicLong rmCnt = new AtomicLong();
+
+    /** Put time taken nanos. */
+    private AtomicLong putTimeNanos = new AtomicLong();
+
+    /** Get time taken nanos. */
+    private AtomicLong getTimeNanos = new AtomicLong();
+
+    /** Remove time taken nanos. */
+    private AtomicLong removeTimeNanos = new AtomicLong();
+
+    /** Commit transaction time taken nanos. */
+    private AtomicLong commitTimeNanos = new AtomicLong();
+
+    /** Commit transaction time taken nanos. */
+    private AtomicLong rollbackTimeNanos = new AtomicLong();
+
+    /** Cache metrics. */
+    @GridToStringExclude
+    private transient CacheMetricsAdapter delegate;
+
+    /** Cache context. */
+    private GridCacheContext<?, ?> cctx;
+
+    /** DHT context. */
+    private GridCacheContext<?, ?> dhtCtx;
+
+    /** Write-behind store, if configured. */
+    private GridCacheWriteBehindStore store;
+
+    /**
+     * Creates cache metrics;
+     *
+     * @param cctx Cache context.
+     */
+    public CacheMetricsAdapter(GridCacheContext<?, ?> cctx) {
+        assert cctx != null;
+
+        this.cctx = cctx;
+
+        if (cctx.isNear())
+            dhtCtx = cctx.near().dht().context();
+
+        if (cctx.store().store() instanceof GridCacheWriteBehindStore)
+            store = (GridCacheWriteBehindStore)cctx.store().store();
+
+        delegate = null;
+    }
+
+    /**
+     * @param delegate Metrics to delegate to.
+     */
+    public void delegate(CacheMetricsAdapter delegate) {
+        this.delegate = delegate;
+    }
+
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return cctx.name();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String metricsFormatted() {
+        return String.valueOf(cctx.cache().metrics());
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOverflowSize() {
+        try {
+            return cctx.cache().overflowSize();
+        }
+        catch (IgniteCheckedException ignored) {
+            return -1;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapEntriesCount() {
+        return cctx.cache().offHeapEntriesCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapAllocatedSize() {
+        return cctx.cache().offHeapAllocatedSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getSize() {
+        return cctx.cache().size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getKeySize() {
+        return cctx.cache().size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isEmpty() {
+        return cctx.cache().isEmpty();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getDhtEvictQueueCurrentSize() {
+        return cctx.isNear() ? dhtCtx.evicts().evictQueueSize() : cctx.evicts().evictQueueSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxCommitQueueSize() {
+        return cctx.tm().commitQueueSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxThreadMapSize() {
+        return cctx.tm().threadMapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxXidMapSize() {
+        return cctx.tm().idMapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxPrepareQueueSize() {
+        return cctx.tm().prepareQueueSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxStartVersionCountsSize() {
+        return cctx.tm().startVersionCountsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxCommittedVersionsSize() {
+        return cctx.tm().committedVersionsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxRolledbackVersionsSize() {
+        return cctx.tm().rolledbackVersionsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtThreadMapSize() {
+        return cctx.isNear() ? dhtCtx.tm().threadMapSize() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtXidMapSize() {
+        return cctx.isNear() ? dhtCtx.tm().idMapSize() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtCommitQueueSize() {
+        return cctx.isNear() ? dhtCtx.tm().commitQueueSize() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtPrepareQueueSize() {
+        return cctx.isNear() ? dhtCtx.tm().prepareQueueSize() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtStartVersionCountsSize() {
+        return cctx.isNear() ? dhtCtx.tm().startVersionCountsSize() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtCommittedVersionsSize() {
+        return cctx.isNear() ? dhtCtx.tm().committedVersionsSize() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtRolledbackVersionsSize() {
+        return cctx.isNear() ? dhtCtx.tm().rolledbackVersionsSize() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWriteBehindEnabled() {
+        return store != null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindFlushSize() {
+        return store != null ? store.getWriteBehindFlushSize() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindFlushThreadCount() {
+        return store != null ? store.getWriteBehindFlushThreadCount() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getWriteBehindFlushFrequency() {
+        return store != null ? store.getWriteBehindFlushFrequency() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindStoreBatchSize() {
+        return store != null ? store.getWriteBehindStoreBatchSize() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindTotalCriticalOverflowCount() {
+        return store != null ? store.getWriteBehindTotalCriticalOverflowCount() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindCriticalOverflowCount() {
+        return store != null ? store.getWriteBehindCriticalOverflowCount() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindErrorRetryCount() {
+        return store != null ? store.getWriteBehindErrorRetryCount() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindBufferSize() {
+        return store != null ? store.getWriteBehindBufferSize() : -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageTxCommitTime() {
+        long timeNanos = commitTimeNanos.get();
+        long commitsCnt = txCommits.get();
+
+        if (timeNanos == 0 || commitsCnt == 0)
+            return 0;
+
+        return ((1f * timeNanos) / commitsCnt) / NANOS_IN_MICROSECOND;
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageTxRollbackTime() {
+        long timeNanos = rollbackTimeNanos.get();
+        long rollbacksCnt = txRollbacks.get();
+
+        if (timeNanos == 0 || rollbacksCnt == 0)
+            return 0;
+
+        return ((1f * timeNanos) / rollbacksCnt) / NANOS_IN_MICROSECOND;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheTxCommits() {
+        return txCommits.get();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheTxRollbacks() {
+        return txRollbacks.get();
+    }
+
+    /**
+     * Clear metrics.
+     */
+    public void clear() {
+        reads.set(0);
+        writes.set(0);
+        rmCnt.set(0);
+        hits.set(0);
+        misses.set(0);
+        evictCnt.set(0);
+        txCommits.set(0);
+        txRollbacks.set(0);
+        putTimeNanos.set(0);
+        removeTimeNanos.set(0);
+        getTimeNanos.set(0);
+        commitTimeNanos.set(0);
+        rollbackTimeNanos.set(0);
+
+        if (delegate != null)
+            delegate.clear();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheHits() {
+        return hits.get();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getCacheHitPercentage() {
+        long hits0 = hits.get();
+        long gets0 = reads.get();
+
+        if (hits0 == 0)
+            return 0;
+
+        return (float) hits0 / gets0 * 100.0f;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheMisses() {
+        return misses.get();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getCacheMissPercentage() {
+        long misses0 = misses.get();
+        long reads0 = reads.get();
+
+        if (misses0 == 0) {
+            return 0;
+        }
+
+        return (float) misses0 / reads0 * 100.0f;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheGets() {
+        return reads.get();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCachePuts() {
+        return writes.get();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheRemovals() {
+        return rmCnt.get();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheEvictions() {
+        return evictCnt.get();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageGetTime() {
+        long timeNanos = getTimeNanos.get();
+        long readsCnt = reads.get();
+
+        if (timeNanos == 0 || readsCnt == 0)
+            return 0;
+
+        return ((1f * timeNanos) / readsCnt) / NANOS_IN_MICROSECOND;
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAveragePutTime() {
+        long timeNanos = putTimeNanos.get();
+        long putsCnt = writes.get();
+
+        if (timeNanos == 0 || putsCnt == 0)
+            return 0;
+
+        return ((1f * timeNanos) / putsCnt) / NANOS_IN_MICROSECOND;
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageRemoveTime() {
+        long timeNanos = removeTimeNanos.get();
+        long removesCnt = rmCnt.get();
+
+        if (timeNanos == 0 || removesCnt == 0)
+            return 0;
+
+        return ((1f * timeNanos) / removesCnt) / NANOS_IN_MICROSECOND;
+    }
+
+    /**
+     * Cache read callback.
+     * @param isHit Hit or miss flag.
+     */
+    public void onRead(boolean isHit) {
+        reads.incrementAndGet();
+
+        if (isHit)
+            hits.incrementAndGet();
+        else
+            misses.incrementAndGet();
+
+        if (delegate != null)
+            delegate.onRead(isHit);
+    }
+
+    /**
+     * Cache write callback.
+     */
+    public void onWrite() {
+        writes.incrementAndGet();
+
+        if (delegate != null)
+            delegate.onWrite();
+    }
+
+    /**
+     * Cache remove callback.
+     */
+    public void onRemove(){
+        rmCnt.incrementAndGet();
+
+        if (delegate != null)
+            delegate.onRemove();
+    }
+
+    /**
+     * Cache remove callback.
+     */
+    public void onEvict() {
+        evictCnt.incrementAndGet();
+
+        if (delegate != null)
+            delegate.onEvict();
+    }
+
+    /**
+     * Transaction commit callback.
+     */
+    public void onTxCommit(long duration) {
+        txCommits.incrementAndGet();
+        commitTimeNanos.addAndGet(duration);
+
+        if (delegate != null) {
+            delegate.onTxCommit(duration);
+        }
+    }
+
+    /**
+     * Transaction rollback callback.
+     */
+    public void onTxRollback(long duration) {
+        txRollbacks.incrementAndGet();
+        rollbackTimeNanos.addAndGet(duration);
+
+        if (delegate != null)
+            delegate.onTxRollback(duration);
+    }
+
+
+    /**
+     * Increments the get time accumulator.
+     *
+     * @param duration the time taken in nanoseconds.
+     */
+    public void addGetTimeNanos(long duration) {
+        getTimeNanos.addAndGet(duration);
+
+        if (delegate != null)
+            delegate.addGetTimeNanos(duration);
+    }
+
+    /**
+     * Increments the put time accumulator.
+     *
+     * @param duration the time taken in nanoseconds.
+     */
+    public void addPutTimeNanos(long duration) {
+        putTimeNanos.addAndGet(duration);
+
+        if (delegate != null)
+            delegate.addPutTimeNanos(duration);
+    }
+
+    /**
+     * Increments the remove time accumulator.
+     *
+     * @param duration the time taken in nanoseconds.
+     */
+    public void addRemoveTimeNanos(long duration) {
+        removeTimeNanos.addAndGet(duration);
+
+        if (delegate != null)
+            delegate.addRemoveTimeNanos(duration);
+    }
+
+    /**
+     * Increments remove and get time accumulators.
+     *
+     * @param duration the time taken in nanoseconds.
+     */
+    public void addRemoveAndGetTimeNanos(long duration) {
+        removeTimeNanos.addAndGet(duration);
+        getTimeNanos.addAndGet(duration);
+
+        if (delegate != null)
+            delegate.addRemoveAndGetTimeNanos(duration);
+    }
+
+    /**
+     * Increments put and get time accumulators.
+     *
+     * @param duration the time taken in nanoseconds.
+     */
+    public void addPutAndGetTimeNanos(long duration) {
+        putTimeNanos.addAndGet(duration);
+        getTimeNanos.addAndGet(duration);
+
+        if (delegate != null)
+            delegate.addPutAndGetTimeNanos(duration);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(CacheMetricsAdapter.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsImpl.java
deleted file mode 100644
index bfff87b..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsImpl.java
+++ /dev/null
@@ -1,370 +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.kernal.processors.cache;
-
-import org.gridgain.grid.cache.*;
-import org.gridgain.grid.util.tostring.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.concurrent.atomic.*;
-
-/**
- * Adapter for cache metrics.
- */
-public class CacheMetricsImpl implements CacheMetrics {
-    /** */
-    private static final long NANOS_IN_MICROSECOND = 1000L;
-
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Number of reads. */
-    private AtomicLong reads = new AtomicLong();
-
-    /** Number of writes. */
-    private AtomicLong writes = new AtomicLong();
-
-    /** Number of hits. */
-    private AtomicLong hits = new AtomicLong();
-
-    /** Number of misses. */
-    private AtomicLong misses = new AtomicLong();
-
-    /** Number of transaction commits. */
-    private AtomicLong txCommits = new AtomicLong();
-
-    /** Number of transaction rollbacks. */
-    private AtomicLong txRollbacks = new AtomicLong();
-
-    /** Number of evictions. */
-    private AtomicLong evictCnt = new AtomicLong();
-
-    /** Number of removed entries. */
-    private AtomicLong rmCnt = new AtomicLong();
-
-    /** Put time taken nanos. */
-    private AtomicLong putTimeNanos = new AtomicLong();
-
-    /** Get time taken nanos. */
-    private AtomicLong getTimeNanos = new AtomicLong();
-
-    /** Remove time taken nanos. */
-    private AtomicLong removeTimeNanos = new AtomicLong();
-
-    /** Commit transaction time taken nanos. */
-    private AtomicLong commitTimeNanos = new AtomicLong();
-
-    /** Commit transaction time taken nanos. */
-    private AtomicLong rollbackTimeNanos = new AtomicLong();
-
-    /** Cache metrics. */
-    @GridToStringExclude
-    private transient CacheMetricsImpl delegate;
-
-    /**
-     * No-args constructor.
-     */
-    public CacheMetricsImpl() {
-        delegate = null;
-    }
-
-    /**
-     * @param delegate Metrics to delegate to.
-     */
-    public void delegate(CacheMetricsImpl delegate) {
-        this.delegate = delegate;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageTxCommitTime() {
-        long timeNanos = commitTimeNanos.get();
-        long commitsCnt = txCommits.get();
-
-        if (timeNanos == 0 || commitsCnt == 0)
-            return 0;
-
-        return ((1f * timeNanos) / commitsCnt) / NANOS_IN_MICROSECOND;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageTxRollbackTime() {
-        long timeNanos = rollbackTimeNanos.get();
-        long rollbacksCnt = txRollbacks.get();
-
-        if (timeNanos == 0 || rollbacksCnt == 0)
-            return 0;
-
-        return ((1f * timeNanos) / rollbacksCnt) / NANOS_IN_MICROSECOND;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheTxCommits() {
-        return txCommits.get();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheTxRollbacks() {
-        return txRollbacks.get();
-    }
-
-    /**
-     * Clear metrics.
-     */
-    public void clear() {
-        reads.set(0);
-        writes.set(0);
-        rmCnt.set(0);
-        hits.set(0);
-        misses.set(0);
-        evictCnt.set(0);
-        txCommits.set(0);
-        txRollbacks.set(0);
-        putTimeNanos.set(0);
-        removeTimeNanos.set(0);
-        getTimeNanos.set(0);
-        commitTimeNanos.set(0);
-        rollbackTimeNanos.set(0);
-
-        if (delegate != null)
-            delegate.clear();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheHits() {
-        return hits.get();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getCacheHitPercentage() {
-        long hits0 = hits.get();
-        long gets0 = reads.get();
-
-        if (hits0 == 0)
-            return 0;
-
-        return (float) hits0 / gets0 * 100.0f;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheMisses() {
-        return misses.get();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getCacheMissPercentage() {
-        long misses0 = misses.get();
-        long reads0 = reads.get();
-
-        if (misses0 == 0) {
-            return 0;
-        }
-
-        return (float) misses0 / reads0 * 100.0f;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheGets() {
-        return reads.get();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCachePuts() {
-        return writes.get();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheRemovals() {
-        return rmCnt.get();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheEvictions() {
-        return evictCnt.get();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageGetTime() {
-        long timeNanos = getTimeNanos.get();
-        long readsCnt = reads.get();
-
-        if (timeNanos == 0 || readsCnt == 0)
-            return 0;
-
-        return ((1f * timeNanos) / readsCnt) / NANOS_IN_MICROSECOND;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAveragePutTime() {
-        long timeNanos = putTimeNanos.get();
-        long putsCnt = writes.get();
-
-        if (timeNanos == 0 || putsCnt == 0)
-            return 0;
-
-        return ((1f * timeNanos) / putsCnt) / NANOS_IN_MICROSECOND;
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageRemoveTime() {
-        long timeNanos = removeTimeNanos.get();
-        long removesCnt = rmCnt.get();
-
-        if (timeNanos == 0 || removesCnt == 0)
-            return 0;
-
-        return ((1f * timeNanos) / removesCnt) / NANOS_IN_MICROSECOND;
-    }
-
-    /**
-     * Cache read callback.
-     * @param isHit Hit or miss flag.
-     */
-    public void onRead(boolean isHit) {
-        reads.incrementAndGet();
-
-        if (isHit)
-            hits.incrementAndGet();
-        else
-            misses.incrementAndGet();
-
-        if (delegate != null)
-            delegate.onRead(isHit);
-    }
-
-    /**
-     * Cache write callback.
-     */
-    public void onWrite() {
-        writes.incrementAndGet();
-
-        if (delegate != null)
-            delegate.onWrite();
-    }
-
-    /**
-     * Cache remove callback.
-     */
-    public void onRemove(){
-        rmCnt.incrementAndGet();
-
-        if (delegate != null)
-            delegate.onRemove();
-    }
-
-    /**
-     * Cache remove callback.
-     */
-    public void onEvict() {
-        evictCnt.incrementAndGet();
-
-        if (delegate != null)
-            delegate.onEvict();
-    }
-
-    /**
-     * Transaction commit callback.
-     */
-    public void onTxCommit(long duration) {
-        txCommits.incrementAndGet();
-        commitTimeNanos.addAndGet(duration);
-
-        if (delegate != null) {
-            delegate.onTxCommit(duration);
-        }
-    }
-
-    /**
-     * Transaction rollback callback.
-     */
-    public void onTxRollback(long duration) {
-        txRollbacks.incrementAndGet();
-        rollbackTimeNanos.addAndGet(duration);
-
-        if (delegate != null)
-            delegate.onTxRollback(duration);
-    }
-
-
-    /**
-     * Increments the get time accumulator.
-     *
-     * @param duration the time taken in nanoseconds.
-     */
-    public void addGetTimeNanos(long duration) {
-        getTimeNanos.addAndGet(duration);
-
-        if (delegate != null)
-            delegate.addGetTimeNanos(duration);
-    }
-
-    /**
-     * Increments the put time accumulator.
-     *
-     * @param duration the time taken in nanoseconds.
-     */
-    public void addPutTimeNanos(long duration) {
-        putTimeNanos.addAndGet(duration);
-
-        if (delegate != null)
-            delegate.addPutTimeNanos(duration);
-    }
-
-    /**
-     * Increments the remove time accumulator.
-     *
-     * @param duration the time taken in nanoseconds.
-     */
-    public void addRemoveTimeNanos(long duration) {
-        removeTimeNanos.addAndGet(duration);
-
-        if (delegate != null)
-            delegate.addRemoveTimeNanos(duration);
-    }
-
-    /**
-     * Increments remove and get time accumulators.
-     *
-     * @param duration the time taken in nanoseconds.
-     */
-    public void addRemoveAndGetTimeNanos(long duration) {
-        removeTimeNanos.addAndGet(duration);
-        getTimeNanos.addAndGet(duration);
-
-        if (delegate != null)
-            delegate.addRemoveAndGetTimeNanos(duration);
-    }
-
-    /**
-     * Increments put and get time accumulators.
-     *
-     * @param duration the time taken in nanoseconds.
-     */
-    public void addPutAndGetTimeNanos(long duration) {
-        putTimeNanos.addAndGet(duration);
-        getTimeNanos.addAndGet(duration);
-
-        if (delegate != null)
-            delegate.addPutAndGetTimeNanos(duration);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(CacheMetricsImpl.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsSnapshot.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsSnapshot.java
index 3d8723d..d8d6b48 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsSnapshot.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsSnapshot.java
@@ -172,6 +172,166 @@ class CacheMetricsSnapshot implements CacheMetrics, Externalizable {
         return txRollbacks;
     }
 
+    @Override
+    public String name() {
+        return null;
+    }
+
+    @Override
+    public String metricsFormatted() {
+        return null;
+    }
+
+    @Override
+    public long getOverflowSize() {
+        return 0;
+    }
+
+    @Override
+    public long getOffHeapEntriesCount() {
+        return 0;
+    }
+
+    @Override
+    public long getOffHeapAllocatedSize() {
+        return 0;
+    }
+
+    @Override
+    public int getSize() {
+        return 0;
+    }
+
+    @Override
+    public int getKeySize() {
+        return 0;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return false;
+    }
+
+    @Override
+    public int getDhtEvictQueueCurrentSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxThreadMapSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxXidMapSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxCommitQueueSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxPrepareQueueSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxStartVersionCountsSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxCommittedVersionsSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxRolledbackVersionsSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxDhtThreadMapSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxDhtXidMapSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxDhtCommitQueueSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxDhtPrepareQueueSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxDhtStartVersionCountsSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxDhtCommittedVersionsSize() {
+        return 0;
+    }
+
+    @Override
+    public int getTxDhtRolledbackVersionsSize() {
+        return 0;
+    }
+
+    @Override
+    public boolean isWriteBehindEnabled() {
+        return false;
+    }
+
+    @Override
+    public int getWriteBehindFlushSize() {
+        return 0;
+    }
+
+    @Override
+    public int getWriteBehindFlushThreadCount() {
+        return 0;
+    }
+
+    @Override
+    public long getWriteBehindFlushFrequency() {
+        return 0;
+    }
+
+    @Override
+    public int getWriteBehindStoreBatchSize() {
+        return 0;
+    }
+
+    @Override
+    public int getWriteBehindTotalCriticalOverflowCount() {
+        return 0;
+    }
+
+    @Override
+    public int getWriteBehindCriticalOverflowCount() {
+        return 0;
+    }
+
+    @Override
+    public int getWriteBehindErrorRetryCount() {
+        return 0;
+    }
+
+    @Override
+    public int getWriteBehindBufferSize() {
+        return 0;
+    }
+
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         out.writeLong(reads);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/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 68f782d..3d959e2 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
@@ -147,7 +147,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
     protected IgniteConfiguration gridCfg;
 
     /** Cache metrics. */
-    protected volatile CacheMetricsImpl metrics;
+    protected CacheMetricsAdapter metrics;
 
     /** Cache mxBean. */
     protected IgniteCacheMxBean mxBean;
@@ -229,7 +229,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
 
         log = ctx.gridConfig().getGridLogger().getLogger(getClass());
 
-        metrics = new CacheMetricsImpl();
+        metrics = new CacheMetricsAdapter(ctx);
 
         mxBean = new CacheMxBeanImpl(ctx);
 
@@ -2194,7 +2194,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
             @Override
             public IgniteFuture<V> op(IgniteTxLocalAdapter<K, V> tx) {
                 return tx.putAllAsync(ctx, F.t(key, val), true, entry, ttl, filter)
-                    .chain((IgniteClosure<IgniteFuture<GridCacheReturn<V>>, V>) RET2VAL);
+                    .chain((IgniteClosure<IgniteFuture<GridCacheReturn<V>>, V>)RET2VAL);
             }
 
             @Override
@@ -3408,7 +3408,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
     /**
      * @return Metrics.
      */
-    public CacheMetricsImpl metrics0() {
+    public CacheMetricsAdapter metrics0() {
         return metrics;
     }
 
@@ -5552,7 +5552,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
      */
     protected static abstract class UpdateTimeStatClosure<T> implements CI1<IgniteFuture<T>> {
         /** */
-        protected final CacheMetricsImpl metrics;
+        protected final CacheMetricsAdapter metrics;
 
         /** */
         protected final long start;
@@ -5561,7 +5561,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
          * @param metrics Metrics.
          * @param start   Start time.
          */
-        public UpdateTimeStatClosure(CacheMetricsImpl metrics, long start) {
+        public UpdateTimeStatClosure(CacheMetricsAdapter metrics, long start) {
             this.metrics = metrics;
             this.start = start;
         }
@@ -5594,7 +5594,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
          * @param metrics Metrics.
          * @param start   Start time.
          */
-        public UpdateGetTimeStatClosure(CacheMetricsImpl metrics, long start) {
+        public UpdateGetTimeStatClosure(CacheMetricsAdapter metrics, long start) {
             super(metrics, start);
         }
 
@@ -5612,7 +5612,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
          * @param metrics Metrics.
          * @param start   Start time.
          */
-        public UpdateRemoveTimeStatClosure(CacheMetricsImpl metrics, long start) {
+        public UpdateRemoveTimeStatClosure(CacheMetricsAdapter metrics, long start) {
             super(metrics, start);
         }
 
@@ -5630,7 +5630,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
          * @param metrics Metrics.
          * @param start   Start time.
          */
-        public UpdatePutTimeStatClosure(CacheMetricsImpl metrics, long start) {
+        public UpdatePutTimeStatClosure(CacheMetricsAdapter metrics, long start) {
             super(metrics, start);
         }
 
@@ -5648,7 +5648,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
          * @param metrics Metrics.
          * @param start   Start time.
          */
-        public UpdatePutAndGetTimeStatClosure(CacheMetricsImpl metrics, long start) {
+        public UpdatePutAndGetTimeStatClosure(CacheMetricsAdapter metrics, long start) {
             super(metrics, start);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCache.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCache.java
index b964ccf..6039b3c 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCache.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtCache.java
@@ -71,7 +71,7 @@ public class GridDhtCache<K, V> extends GridDhtTransactionalCacheAdapter<K, V> {
 
     /** {@inheritDoc} */
     @Override public void start() throws IgniteCheckedException {
-        CacheMetricsImpl m = new CacheMetricsImpl();
+        CacheMetricsAdapter m = new CacheMetricsAdapter(ctx);
 
         m.delegate(ctx.dht().near().metrics0());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 7435ccd..94e91e3 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -154,7 +154,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     @Override public void start() throws IgniteCheckedException {
         super.start();
 
-        CacheMetricsImpl m = new CacheMetricsImpl();
+        CacheMetricsAdapter m = new CacheMetricsAdapter(ctx);
 
         if (ctx.dht().near() != null)
             m.delegate(ctx.dht().near().metrics0());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4288e32/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/atomic/GridLocalAtomicCache.java
index 0e17bd5..72f4f45 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -449,7 +449,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
             Collections.singleton(key),
             null,
             null,
-                expiryPerCall(),
+            expiryPerCall(),
             false,
             false,
             ctx.equalsPeekArray(val),
@@ -482,7 +482,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         String taskName = ctx.kernalContext().job().currentTaskName();
 
         Map<K, V> m = getAllInternal(Collections.singleton(key),
-                filter != null ? new IgnitePredicate[]{filter} : null,
+            filter != null ? new IgnitePredicate[]{filter} : null,
             ctx.isSwapOrOffheapEnabled(),
             ctx.readThrough(),
             ctx.hasFlag(CLONE),
@@ -502,7 +502,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
         String taskName = ctx.kernalContext().job().currentTaskName();
 
         return getAllInternal(keys,
-                filter != null ? new IgnitePredicate[]{filter} : null,
+            filter != null ? new IgnitePredicate[]{filter} : null,
             ctx.isSwapOrOffheapEnabled(),
             ctx.readThrough(),
             ctx.hasFlag(CLONE),


Mime
View raw message