http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/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 new file mode 100644 index 0000000..1794897 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetrics.java @@ -0,0 +1,143 @@ +/* + * 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 org.apache.ignite.*; + +/** + * Cache metrics used to obtain statistics on cache itself. + * Use {@link IgniteCache#metrics()} to obtain metrics for a cache. + */ +public interface CacheMetrics { + /** + * Clears the statistics counters to 0 for the associated Cache. + */ + void clear(); + + /** + * The number of get requests that were satisfied by the cache. + * + * @return the number of hits + */ + long getCacheHits(); + + /** + * This is a measure of cache efficiency. + * + * @return the percentage of successful hits, as a decimal e.g 75. + */ + float getCacheHitPercentage(); + + /** + * A miss is a get request that is not satisfied. + * + * @return the number of misses + */ + long getCacheMisses(); + + /** + * Returns the percentage of cache accesses that did not find a requested entry + * in the cache. + * + * @return the percentage of accesses that failed to find anything + */ + float getCacheMissPercentage(); + + /** + * The total number of requests to the cache. This will be equal to the sum of + * the hits and misses. + * + * @return the number of gets + */ + long getCacheGets(); + + /** + * The total number of puts to the cache. + * + * @return the number of puts + */ + long getCachePuts(); + + /** + * The total number of removals from the cache. This does not include evictions, + * where the cache itself initiates the removal to make space. + * + * @return the number of removals + */ + long getCacheRemovals(); + + /** + * The total number of evictions from the cache. An eviction is a removal + * initiated by the cache itself to free up space. An eviction is not treated as + * a removal and does not appear in the removal counts. + * + * @return the number of evictions + */ + long getCacheEvictions(); + + /** + * The mean time to execute gets. + * + * @return the time in µs + */ + float getAverageGetTime(); + + /** + * The mean time to execute puts. + * + * @return the time in µs + */ + float getAveragePutTime(); + + /** + * The mean time to execute removes. + * + * @return the time in µs + */ + float getAverageRemoveTime(); + + + /** + * 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 long getCacheTxCommits(); + + /** + * Gets total number of transaction rollbacks. + * + * @return Number of transaction rollbacks. + */ + public long getCacheTxRollbacks(); +}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/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 deleted file mode 100644 index bc7fe2c..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetricsMxBean.java +++ /dev/null @@ -1,143 +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 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 { - /** - * Clears the statistics counters to 0 for the associated Cache. - */ - void clear(); - - /** - * The number of get requests that were satisfied by the cache. - * - * @return the number of hits - */ - long getCacheHits(); - - /** - * This is a measure of cache efficiency. - * - * @return the percentage of successful hits, as a decimal e.g 75. - */ - float getCacheHitPercentage(); - - /** - * A miss is a get request that is not satisfied. - * - * @return the number of misses - */ - long getCacheMisses(); - - /** - * Returns the percentage of cache accesses that did not find a requested entry - * in the cache. - * - * @return the percentage of accesses that failed to find anything - */ - float getCacheMissPercentage(); - - /** - * The total number of requests to the cache. This will be equal to the sum of - * the hits and misses. - * - * @return the number of gets - */ - long getCacheGets(); - - /** - * The total number of puts to the cache. - * - * @return the number of puts - */ - long getCachePuts(); - - /** - * The total number of removals from the cache. This does not include evictions, - * where the cache itself initiates the removal to make space. - * - * @return the number of removals - */ - long getCacheRemovals(); - - /** - * The total number of evictions from the cache. An eviction is a removal - * initiated by the cache itself to free up space. An eviction is not treated as - * a removal and does not appear in the removal counts. - * - * @return the number of evictions - */ - long getCacheEvictions(); - - /** - * The mean time to execute gets. - * - * @return the time in µs - */ - float getAverageGetTime(); - - /** - * The mean time to execute puts. - * - * @return the time in µs - */ - float getAveragePutTime(); - - /** - * The mean time to execute removes. - * - * @return the time in µs - */ - float getAverageRemoveTime(); - - - /** - * 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 long getCacheTxCommits(); - - /** - * Gets total number of transaction rollbacks. - * - * @return Number of transaction rollbacks. - */ - public long getCacheTxRollbacks(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/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 977a882..c3b093b 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 @@ -116,7 +116,7 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { * * @return Cache metrics. */ - public CacheMetricsMxBean metrics(); + public CacheMetrics metrics(); /** * Gets size (in bytes) of all entries swapped to disk. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMBean.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMBean.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMBean.java deleted file mode 100644 index 43cc089..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheMBean.java +++ /dev/null @@ -1,296 +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 org.apache.ignite.cache.CacheConfiguration; -import org.apache.ignite.mbean.*; - -/** - * This interface defines JMX view on {@link GridCache}. - */ -@IgniteMBeanDescription("MBean that provides access to cache descriptor.") -public interface GridCacheMBean { - /** - * Gets name of this cache. - * - * @return Cache name. - */ - @IgniteMBeanDescription("Cache name.") - public String name(); - - /** - * Gets metrics (statistics) for this cache. - * - * @return Cache metrics. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @IgniteMBeanDescription("Current size of evict queue.") - public int getDhtEvictQueueCurrentSize(); - - /** - * Gets transaction per-thread map size. - * - * @return Thread map size. - */ - @IgniteMBeanDescription("Transaction per-thread map size.") - public int getTxThreadMapSize(); - - /** - * Gets transaction per-Xid map size. - * - * @return Transaction per-Xid map size. - */ - @IgniteMBeanDescription("Transaction per-Xid map size.") - public int getTxXidMapSize(); - - /** - * Gets committed transaction queue size. - * - * @return Committed transaction queue size. - */ - @IgniteMBeanDescription("Transaction committed queue size.") - public int getTxCommitQueueSize(); - - /** - * Gets prepared transaction queue size. - * - * @return Prepared transaction queue size. - */ - @IgniteMBeanDescription("Transaction prepared queue size.") - public int getTxPrepareQueueSize(); - - /** - * Gets start version counts map size. - * - * @return Start version counts map size. - */ - @IgniteMBeanDescription("Transaction start version counts map size.") - public int getTxStartVersionCountsSize(); - - /** - * Gets number of cached committed transaction IDs. - * - * @return Number of cached committed transaction IDs. - */ - @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. - */ - @IgniteMBeanDescription("Transaction rolled back ID map size.") - public int getTxRolledbackVersionsSize(); - - /** - * Gets transaction DHT per-thread map size. - * - * @return DHT thread map size. - */ - @IgniteMBeanDescription("Transaction DHT per-thread map size.") - public int getTxDhtThreadMapSize(); - - /** - * Gets transaction DHT per-Xid map size. - * - * @return Transaction DHT per-Xid map size. - */ - @IgniteMBeanDescription("Transaction DHT per-Xid map size.") - public int getTxDhtXidMapSize(); - - /** - * Gets committed DHT transaction queue size. - * - * @return Committed DHT transaction queue size. - */ - @IgniteMBeanDescription("Transaction DHT committed queue size.") - public int getTxDhtCommitQueueSize(); - - /** - * Gets prepared DHT transaction queue size. - * - * @return Prepared DHT transaction queue size. - */ - @IgniteMBeanDescription("Transaction DHT prepared queue size.") - public int getTxDhtPrepareQueueSize(); - - /** - * Gets DHT start version counts map size. - * - * @return DHT start version counts map size. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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/4277989b/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 new file mode 100644 index 0000000..6e4b134 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/cache/IgniteCacheMxBean.java @@ -0,0 +1,362 @@ +/* + * 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 org.apache.ignite.cache.CacheConfiguration; +import org.apache.ignite.mbean.*; + +import javax.cache.management.CacheStatisticsMXBean; + +/** + * This interface defines JMX view on {@link GridCache}. + */ +@IgniteMBeanDescription("MBean that provides access to cache descriptor.") +public interface IgniteCacheMxBean extends CacheStatisticsMXBean, CacheMetrics { + /** {@inheritDoc} */ + @IgniteMBeanDescription("Clear statistics.") + public void clear(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Number of hits.") + public long getCacheHits(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Percentage of successful hits.") + public float getCacheHitPercentage(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Number of misses.") + public long getCacheMisses(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Percentage of accesses that failed to find anything.") + public float getCacheMissPercentage(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Number of gets.") + public long getCacheGets(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Number of puts.") + public long getCachePuts(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Number of removals.") + public long getCacheRemovals(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Number of eviction entries.") + public long getCacheEvictions(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Average time to execute get.") + public float getAverageGetTime(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Average time to execute put.") + public float getAveragePutTime(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Average time to execute remove.") + public float getAverageRemoveTime(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Average time to commit transaction.") + public float getAverageTxCommitTime(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Average time to rollback transaction.") + public float getAverageTxRollbackTime(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Number of transaction commits.") + public long getCacheTxCommits(); + + /** {@inheritDoc} */ + @IgniteMBeanDescription("Number of transaction rollback.") + public long getCacheTxRollbacks(); + + /** + * Gets name of this cache. + * + * @return Cache name. + */ + @IgniteMBeanDescription("Cache name.") + public String name(); + + /** + * Gets metrics (statistics) for this cache. + * + * @return Cache metrics. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @IgniteMBeanDescription("Current size of evict queue.") + public int getDhtEvictQueueCurrentSize(); + + /** + * Gets transaction per-thread map size. + * + * @return Thread map size. + */ + @IgniteMBeanDescription("Transaction per-thread map size.") + public int getTxThreadMapSize(); + + /** + * Gets transaction per-Xid map size. + * + * @return Transaction per-Xid map size. + */ + @IgniteMBeanDescription("Transaction per-Xid map size.") + public int getTxXidMapSize(); + + /** + * Gets committed transaction queue size. + * + * @return Committed transaction queue size. + */ + @IgniteMBeanDescription("Transaction committed queue size.") + public int getTxCommitQueueSize(); + + /** + * Gets prepared transaction queue size. + * + * @return Prepared transaction queue size. + */ + @IgniteMBeanDescription("Transaction prepared queue size.") + public int getTxPrepareQueueSize(); + + /** + * Gets start version counts map size. + * + * @return Start version counts map size. + */ + @IgniteMBeanDescription("Transaction start version counts map size.") + public int getTxStartVersionCountsSize(); + + /** + * Gets number of cached committed transaction IDs. + * + * @return Number of cached committed transaction IDs. + */ + @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. + */ + @IgniteMBeanDescription("Transaction rolled back ID map size.") + public int getTxRolledbackVersionsSize(); + + /** + * Gets transaction DHT per-thread map size. + * + * @return DHT thread map size. + */ + @IgniteMBeanDescription("Transaction DHT per-thread map size.") + public int getTxDhtThreadMapSize(); + + /** + * Gets transaction DHT per-Xid map size. + * + * @return Transaction DHT per-Xid map size. + */ + @IgniteMBeanDescription("Transaction DHT per-Xid map size.") + public int getTxDhtXidMapSize(); + + /** + * Gets committed DHT transaction queue size. + * + * @return Committed DHT transaction queue size. + */ + @IgniteMBeanDescription("Transaction DHT committed queue size.") + public int getTxDhtCommitQueueSize(); + + /** + * Gets prepared DHT transaction queue size. + * + * @return Prepared DHT transaction queue size. + */ + @IgniteMBeanDescription("Transaction DHT prepared queue size.") + public int getTxDhtPrepareQueueSize(); + + /** + * Gets DHT start version counts map size. + * + * @return DHT start version counts map size. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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/4277989b/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterLocalNodeMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterLocalNodeMetrics.java b/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterLocalNodeMetrics.java new file mode 100644 index 0000000..6849246 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterLocalNodeMetrics.java @@ -0,0 +1,311 @@ +/* + * 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; + +import org.apache.ignite.cluster.*; +import org.gridgain.grid.util.typedef.internal.*; + +/** + * Local node metrics MBean. + */ +public class ClusterLocalNodeMetrics implements ClusterNodeMetricsMxBean { + /** */ + private static final long serialVersionUID = 0L; + + /** Grid node. */ + private final ClusterNode node; + + /** + * @param node Node to manage. + */ + public ClusterLocalNodeMetrics(ClusterNode node) { + assert node != null; + + this.node = node; + } + + /** {@inheritDoc} */ + @Override public int getTotalCpus() { + return node.metrics().getTotalCpus(); + } + + /** {@inheritDoc} */ + @Override public float getAverageActiveJobs() { + return node.metrics().getAverageActiveJobs(); + } + + /** {@inheritDoc} */ + @Override public float getAverageCancelledJobs() { + return node.metrics().getAverageCancelledJobs(); + } + + /** {@inheritDoc} */ + @Override public double getAverageJobExecuteTime() { + return node.metrics().getAverageJobExecuteTime(); + } + + /** {@inheritDoc} */ + @Override public double getAverageJobWaitTime() { + return node.metrics().getAverageJobWaitTime(); + } + + /** {@inheritDoc} */ + @Override public float getAverageRejectedJobs() { + return node.metrics().getAverageRejectedJobs(); + } + + /** {@inheritDoc} */ + @Override public float getAverageWaitingJobs() { + return node.metrics().getAverageWaitingJobs(); + } + + /** {@inheritDoc} */ + @Override public float getBusyTimePercentage() { + return node.metrics().getBusyTimePercentage() * 100; + } + + /** {@inheritDoc} */ + @Override public int getCurrentActiveJobs() { + return node.metrics().getCurrentActiveJobs(); + } + + /** {@inheritDoc} */ + @Override public int getCurrentCancelledJobs() { + return node.metrics().getCurrentCancelledJobs(); + } + + /** {@inheritDoc} */ + @Override public long getCurrentIdleTime() { + return node.metrics().getCurrentIdleTime(); + } + + /** {@inheritDoc} */ + @Override public long getCurrentJobExecuteTime() { + return node.metrics().getCurrentJobExecuteTime(); + } + + /** {@inheritDoc} */ + @Override public long getCurrentJobWaitTime() { + return node.metrics().getCurrentJobWaitTime(); + } + + /** {@inheritDoc} */ + @Override public int getCurrentRejectedJobs() { + return node.metrics().getCurrentRejectedJobs(); + } + + /** {@inheritDoc} */ + @Override public int getCurrentWaitingJobs() { + return node.metrics().getCurrentWaitingJobs(); + } + + /** {@inheritDoc} */ + @Override public int getTotalExecutedTasks() { + return node.metrics().getTotalExecutedTasks(); + } + + /** {@inheritDoc} */ + @Override public int getCurrentDaemonThreadCount() { + return node.metrics().getCurrentDaemonThreadCount(); + } + + /** {@inheritDoc} */ + @Override public long getHeapMemoryCommitted() { + return node.metrics().getHeapMemoryCommitted(); + } + + /** {@inheritDoc} */ + @Override public long getHeapMemoryInitialized() { + return node.metrics().getHeapMemoryInitialized(); + } + + /** {@inheritDoc} */ + @Override public long getHeapMemoryMaximum() { + return node.metrics().getHeapMemoryMaximum(); + } + + /** {@inheritDoc} */ + @Override public long getHeapMemoryUsed() { + return node.metrics().getHeapMemoryUsed(); + } + + /** {@inheritDoc} */ + @Override public float getIdleTimePercentage() { + return node.metrics().getIdleTimePercentage() * 100; + } + + /** {@inheritDoc} */ + @Override public long getLastUpdateTime() { + return node.metrics().getLastUpdateTime(); + } + + /** {@inheritDoc} */ + @Override public int getMaximumActiveJobs() { + return node.metrics().getMaximumActiveJobs(); + } + + /** {@inheritDoc} */ + @Override public int getMaximumCancelledJobs() { + return node.metrics().getMaximumCancelledJobs(); + } + + /** {@inheritDoc} */ + @Override public long getMaximumJobExecuteTime() { + return node.metrics().getMaximumJobExecuteTime(); + } + + /** {@inheritDoc} */ + @Override public long getMaximumJobWaitTime() { + return node.metrics().getMaximumJobWaitTime(); + } + + /** {@inheritDoc} */ + @Override public int getMaximumRejectedJobs() { + return node.metrics().getMaximumRejectedJobs(); + } + + /** {@inheritDoc} */ + @Override public int getMaximumWaitingJobs() { + return node.metrics().getMaximumWaitingJobs(); + } + + /** {@inheritDoc} */ + @Override public long getNonHeapMemoryCommitted() { + return node.metrics().getNonHeapMemoryCommitted(); + } + + /** {@inheritDoc} */ + @Override public long getNonHeapMemoryInitialized() { + return node.metrics().getNonHeapMemoryInitialized(); + } + + /** {@inheritDoc} */ + @Override public long getNonHeapMemoryMaximum() { + return node.metrics().getNonHeapMemoryMaximum(); + } + + /** {@inheritDoc} */ + @Override public long getNonHeapMemoryUsed() { + return node.metrics().getNonHeapMemoryUsed(); + } + + /** {@inheritDoc} */ + @Override public int getMaximumThreadCount() { + return node.metrics().getMaximumThreadCount(); + } + + /** {@inheritDoc} */ + @Override public long getStartTime() { + return node.metrics().getStartTime(); + } + + /** {@inheritDoc} */ + @Override public long getNodeStartTime() { + return node.metrics().getNodeStartTime(); + } + + /** {@inheritDoc} */ + @Override public double getCurrentCpuLoad() { + return node.metrics().getCurrentCpuLoad() * 100; + } + + /** {@inheritDoc} */ + @Override public double getAverageCpuLoad() { + return node.metrics().getAverageCpuLoad() * 100; + } + + /** {@inheritDoc} */ + @Override public double getCurrentGcCpuLoad() { + return node.metrics().getCurrentGcCpuLoad() * 100; + } + + /** {@inheritDoc} */ + @Override public int getCurrentThreadCount() { + return node.metrics().getCurrentThreadCount(); + } + + /** {@inheritDoc} */ + @Override public long getTotalBusyTime() { + return node.metrics().getTotalBusyTime(); + } + + /** {@inheritDoc} */ + @Override public int getTotalCancelledJobs() { + return node.metrics().getTotalCancelledJobs(); + } + + /** {@inheritDoc} */ + @Override public int getTotalExecutedJobs() { + return node.metrics().getTotalExecutedJobs(); + } + + /** {@inheritDoc} */ + @Override public long getTotalIdleTime() { + return node.metrics().getTotalIdleTime(); + } + + /** {@inheritDoc} */ + @Override public int getTotalRejectedJobs() { + return node.metrics().getTotalRejectedJobs(); + } + + /** {@inheritDoc} */ + @Override public long getTotalStartedThreadCount() { + return node.metrics().getTotalStartedThreadCount(); + } + + /** {@inheritDoc} */ + @Override public long getUpTime() { + return node.metrics().getUpTime(); + } + + /** {@inheritDoc} */ + @Override public long getLastDataVersion() { + return node.metrics().getLastDataVersion(); + } + + /** {@inheritDoc} */ + @Override public int getSentMessagesCount() { + return node.metrics().getSentMessagesCount(); + } + + /** {@inheritDoc} */ + @Override public long getSentBytesCount() { + return node.metrics().getSentBytesCount(); + } + + /** {@inheritDoc} */ + @Override public int getReceivedMessagesCount() { + return node.metrics().getReceivedMessagesCount(); + } + + /** {@inheritDoc} */ + @Override public long getReceivedBytesCount() { + return node.metrics().getReceivedBytesCount(); + } + + /** {@inheritDoc} */ + @Override public int getOutboundMessagesQueueSize() { + return node.metrics().getOutboundMessagesQueueSize(); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(ClusterLocalNodeMetrics.class, this); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterMetricsImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterMetricsImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterMetricsImpl.java index faf7896..5f6ac91 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterMetricsImpl.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterMetricsImpl.java @@ -260,7 +260,7 @@ class ClusterMetricsImpl implements ClusterMetrics { int size = nodes.size(); for (ClusterNode node : nodes) { - ClusterNodeMetricsMBean m = node.metrics(); + ClusterNodeMetrics m = node.metrics(); minActJobs = min(minActJobs, m.getCurrentActiveJobs()); maxActJobs = max(maxActJobs, m.getCurrentActiveJobs()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterNodeMetricsMxBean.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterNodeMetricsMxBean.java b/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterNodeMetricsMxBean.java new file mode 100644 index 0000000..43f4186 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/ClusterNodeMetricsMxBean.java @@ -0,0 +1,29 @@ +/* + * 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; + +import org.apache.ignite.cluster.*; +import org.apache.ignite.mbean.*; + +/** + * MBean for local node metrics. + */ +@IgniteMBeanDescription("MBean that provides access to all local node metrics.") +public interface ClusterNodeMetricsMxBean extends ClusterNodeMetrics { + // No-op. +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java index 049b7e6..fa2349f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java @@ -961,7 +961,7 @@ public class GridKernal extends ClusterGroupAdapter implements GridEx, IgniteMBe @Override protected void safeRun() { if (log.isInfoEnabled()) { - ClusterNodeMetricsMBean m = localNode().metrics(); + ClusterNodeMetrics m = localNode().metrics(); double cpuLoadPct = m.getCurrentCpuLoad() * 100; double avgCpuLoadPct = m.getAverageCpuLoad() * 100; @@ -1447,7 +1447,7 @@ public class GridKernal extends ClusterGroupAdapter implements GridEx, IgniteMBe /** @throws IgniteCheckedException If registration failed. */ private void registerLocalNodeMBean() throws IgniteCheckedException { - ClusterNodeMetricsMBean mbean = ctx.discovery().localNode().metrics(); + ClusterNodeMetricsMxBean mbean = new ClusterLocalNodeMetrics(ctx.discovery().localNode()); try { locNodeMBean = U.registerMBean( @@ -1456,7 +1456,7 @@ public class GridKernal extends ClusterGroupAdapter implements GridEx, IgniteMBe "Kernal", mbean.getClass().getSimpleName(), mbean, - ClusterNodeMetricsMBean.class); + ClusterNodeMetricsMxBean.class); if (log.isDebugEnabled()) log.debug("Registered local node MBean: " + locNodeMBean); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/discovery/GridDiscoveryManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/discovery/GridDiscoveryManager.java index 7b0c31b..79eb973 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/discovery/GridDiscoveryManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/discovery/GridDiscoveryManager.java @@ -494,7 +494,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> { private final long startTime = U.currentTimeMillis(); /** {@inheritDoc} */ - @Override public ClusterNodeMetricsMBean getMetrics() { + @Override public ClusterNodeMetrics getMetrics() { GridJobMetrics jm = ctx.jobMetric().getJobMetrics(); DiscoveryNodeMetricsAdapter nm = new DiscoveryNodeMetricsAdapter(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/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 new file mode 100644 index 0000000..cb98ed7 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsImpl.java @@ -0,0 +1,404 @@ +/* + * 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, Externalizable { + /** */ + 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(); + } + + /** {@inheritDoc} */ + @Override 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 void writeExternal(ObjectOutput out) throws IOException { + out.writeLong(reads.get()); + out.writeLong(writes.get()); + out.writeLong(hits.get()); + out.writeLong(misses.get()); + out.writeLong(txCommits.get()); + out.writeLong(txRollbacks.get()); + out.writeLong(rmCnt.get()); + out.writeLong(evictCnt.get()); + + out.writeLong(putTimeNanos.get()); + out.writeLong(getTimeNanos.get()); + out.writeLong(removeTimeNanos.get()); + out.writeLong(commitTimeNanos.get()); + out.writeLong(rollbackTimeNanos.get()); + } + + /** {@inheritDoc} */ + @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + reads = new AtomicLong(in.readLong()); + writes = new AtomicLong(in.readLong()); + hits = new AtomicLong(in.readLong()); + misses = new AtomicLong(in.readLong()); + txCommits = new AtomicLong(in.readLong()); + txRollbacks = new AtomicLong(in.readLong()); + rmCnt = new AtomicLong(in.readLong()); + evictCnt = new AtomicLong(in.readLong()); + + putTimeNanos = new AtomicLong(in.readLong()); + getTimeNanos = new AtomicLong(in.readLong()); + removeTimeNanos = new AtomicLong(in.readLong()); + commitTimeNanos = new AtomicLong(in.readLong()); + rollbackTimeNanos = new AtomicLong(in.readLong()); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(CacheMetricsImpl.class, this); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsMxBeanImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsMxBeanImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsMxBeanImpl.java deleted file mode 100644 index 3f9bbd9..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMetricsMxBeanImpl.java +++ /dev/null @@ -1,405 +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 javax.cache.management.*; -import java.io.*; -import java.util.concurrent.atomic.*; - -/** - * Adapter for cache metrics. - */ -public class CacheMetricsMxBeanImpl implements CacheMetricsMxBean, CacheStatisticsMXBean, Externalizable { - /** */ - 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 CacheMetricsMxBeanImpl delegate; - - /** - * No-args constructor. - */ - public CacheMetricsMxBeanImpl() { - delegate = null; - } - - /** - * @param delegate Metrics to delegate to. - */ - public void delegate(CacheMetricsMxBeanImpl 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(); - } - - /** {@inheritDoc} */ - @Override 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 void writeExternal(ObjectOutput out) throws IOException { - out.writeLong(reads.get()); - out.writeLong(writes.get()); - out.writeLong(hits.get()); - out.writeLong(misses.get()); - out.writeLong(txCommits.get()); - out.writeLong(txRollbacks.get()); - out.writeLong(rmCnt.get()); - out.writeLong(evictCnt.get()); - - out.writeLong(putTimeNanos.get()); - out.writeLong(getTimeNanos.get()); - out.writeLong(removeTimeNanos.get()); - out.writeLong(commitTimeNanos.get()); - out.writeLong(rollbackTimeNanos.get()); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - reads = new AtomicLong(in.readLong()); - writes = new AtomicLong(in.readLong()); - hits = new AtomicLong(in.readLong()); - misses = new AtomicLong(in.readLong()); - txCommits = new AtomicLong(in.readLong()); - txRollbacks = new AtomicLong(in.readLong()); - rmCnt = new AtomicLong(in.readLong()); - evictCnt = new AtomicLong(in.readLong()); - - putTimeNanos = new AtomicLong(in.readLong()); - getTimeNanos = new AtomicLong(in.readLong()); - removeTimeNanos = new AtomicLong(in.readLong()); - commitTimeNanos = new AtomicLong(in.readLong()); - rollbackTimeNanos = new AtomicLong(in.readLong()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(CacheMetricsMxBeanImpl.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMxBeanAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMxBeanAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMxBeanAdapter.java new file mode 100644 index 0000000..199b417 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheMxBeanAdapter.java @@ -0,0 +1,296 @@ +/* + * 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.*; + +/** + * Management bean that provides access to {@link GridCache}. + */ +class CacheMxBeanAdapter implements IgniteCacheMxBean { + /** Cache context. */ + private GridCacheContext<?, ?> cctx; + + /** DHT context. */ + private GridCacheContext<?, ?> dhtCtx; + + /** Write-behind store, if configured. */ + private GridCacheWriteBehindStore store; + + /** + * Creates MBean; + * + * @param cctx Cache context. + */ + CacheMxBeanAdapter(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(); + } + + /** {@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 void clear() { + } + + /** {@inheritDoc} */ + @Override public long getCacheHits() { + return 0; + } + + /** {@inheritDoc} */ + @Override public float getCacheHitPercentage() { + return 0; + } + + /** {@inheritDoc} */ + @Override public long getCacheMisses() { + return 0; + } + + /** {@inheritDoc} */ + @Override public float getCacheMissPercentage() { + return 0; + } + + /** {@inheritDoc} */ + @Override public long getCacheGets() { + return 0; + } + + /** {@inheritDoc} */ + @Override public long getCachePuts() { + return 0; + } + + /** {@inheritDoc} */ + @Override public long getCacheRemovals() { + return 0; + } + + /** {@inheritDoc} */ + @Override public long getCacheEvictions() { + return 0; + } + + /** {@inheritDoc} */ + @Override public float getAverageGetTime() { + return 0; + } + + /** {@inheritDoc} */ + @Override public float getAveragePutTime() { + return 0; + } + + /** {@inheritDoc} */ + @Override public float getAverageRemoveTime() { + return 0; + } + + /** {@inheritDoc} */ + @Override public float getAverageTxCommitTime() { + return 0; + } + + /** {@inheritDoc} */ + @Override public float getAverageTxRollbackTime() { + return 0; + } + + /** {@inheritDoc} */ + @Override public long getCacheTxCommits() { + return 0; + } + + /** {@inheritDoc} */ + @Override public long getCacheTxRollbacks() { + return 0; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4277989b/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 a90c8a8..1f9cdb0 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 @@ -22,7 +22,6 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.compute.*; import org.apache.ignite.configuration.*; -import org.apache.ignite.dataload.*; import org.apache.ignite.fs.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.security.*; @@ -148,7 +147,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, protected IgniteConfiguration gridCfg; /** Cache metrics. */ - protected volatile CacheMetricsMxBeanImpl metrics; + protected volatile CacheMetricsImpl metrics; /** Logger. */ protected IgniteLogger log; @@ -227,7 +226,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, log = ctx.gridConfig().getGridLogger().getLogger(getClass()); - metrics = new CacheMetricsMxBeanImpl(); + metrics = new CacheMetricsImpl(); IgniteFsConfiguration[] ggfsCfgs = gridCfg.getGgfsConfiguration(); @@ -3392,14 +3391,14 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, } /** {@inheritDoc} */ - @Override public CacheMetricsMxBean metrics() { + @Override public CacheMetrics metrics() { return metrics; } /** * @return Metrics. */ - public CacheMetricsMxBeanImpl metrics0() { + public CacheMetricsImpl metrics0() { return metrics; } @@ -5543,7 +5542,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, */ protected static abstract class UpdateTimeStatClosure<T> implements CI1<IgniteFuture<T>> { /** */ - protected final CacheMetricsMxBeanImpl metrics; + protected final CacheMetricsImpl metrics; /** */ protected final long start; @@ -5552,7 +5551,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, * @param metrics Metrics. * @param start Start time. */ - public UpdateTimeStatClosure(CacheMetricsMxBeanImpl metrics, long start) { + public UpdateTimeStatClosure(CacheMetricsImpl metrics, long start) { this.metrics = metrics; this.start = start; } @@ -5585,7 +5584,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, * @param metrics Metrics. * @param start Start time. */ - public UpdateGetTimeStatClosure(CacheMetricsMxBeanImpl metrics, long start) { + public UpdateGetTimeStatClosure(CacheMetricsImpl metrics, long start) { super(metrics, start); } @@ -5603,7 +5602,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, * @param metrics Metrics. * @param start Start time. */ - public UpdateRemoveTimeStatClosure(CacheMetricsMxBeanImpl metrics, long start) { + public UpdateRemoveTimeStatClosure(CacheMetricsImpl metrics, long start) { super(metrics, start); } @@ -5621,7 +5620,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, * @param metrics Metrics. * @param start Start time. */ - public UpdatePutTimeStatClosure(CacheMetricsMxBeanImpl metrics, long start) { + public UpdatePutTimeStatClosure(CacheMetricsImpl metrics, long start) { super(metrics, start); } @@ -5639,7 +5638,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, * @param metrics Metrics. * @param start Start time. */ - public UpdatePutAndGetTimeStatClosure(CacheMetricsMxBeanImpl metrics, long start) { + public UpdatePutAndGetTimeStatClosure(CacheMetricsImpl metrics, long start) { super(metrics, start); }