ignite-commits mailing list archives

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


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

Branch: refs/heads/ignite-49
Commit: 5a9d57a309a259ad7960db45a24c7c1723651fb6
Parents: 37ed9c1
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Thu Jan 22 16:04:53 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Thu Jan 22 16:13:42 2015 +0300

----------------------------------------------------------------------
 .../integration/GridClientAbstractSelfTest.java |  4 +-
 .../rest/GridRestBinaryProtocolSelfTest.java    |  4 +-
 .../rest/GridRestMemcacheProtocolSelfTest.java  |  4 +-
 .../java/org/apache/ignite/CacheMXBeanImpl.java | 73 +++++++++++++++++++
 .../java/org/apache/ignite/IgniteCache.java     |  1 -
 .../org/apache/ignite/IgniteCacheMXBean.java    | 75 --------------------
 .../org/apache/ignite/IgniteCacheManager.java   | 24 +++----
 .../cache/CacheMetricsMxBeanImpl.java           |  4 +-
 .../processors/cache/GridCacheAdapter.java      |  3 +-
 .../dht/atomic/GridDhtAtomicCache.java          |  5 +-
 10 files changed, 97 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a9d57a3/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 1e0f794..455a8cb 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).resetMetrics();
-        grid().cache(CACHE_NAME).resetMetrics();
+        grid().cache(null).metrics().clear();
+        grid().cache(CACHE_NAME).metrics().clear();
 
         grid().cache(null).putx("key1", "val");
         grid().cache(null).putx("key2", "val");

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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a9d57a3/modules/core/src/main/java/org/apache/ignite/CacheMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/CacheMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/CacheMXBeanImpl.java
new file mode 100644
index 0000000..fe4f93d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/CacheMXBeanImpl.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite;
+
+import javax.cache.*;
+import javax.cache.configuration.*;
+import javax.cache.management.*;
+
+/**
+ * Implementation of {@link CacheMXBean}.
+ *
+ */
+public class CacheMXBeanImpl implements CacheMXBean {
+    /** */
+    private final Cache<?, ?> cache;
+
+    /**
+     * @param cache Cache.
+     */
+    public CacheMXBeanImpl(Cache<?, ?> cache) {
+        this.cache = cache;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getKeyType() {
+        return cache.getConfiguration(CompleteConfiguration.class).getKeyType().getName();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getValueType() {
+        return cache.getConfiguration(CompleteConfiguration.class).getValueType().getName();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isReadThrough() {
+        return cache.getConfiguration(CompleteConfiguration.class).isReadThrough();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWriteThrough() {
+        return cache.getConfiguration(CompleteConfiguration.class).isWriteThrough();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isStoreByValue() {
+        return cache.getConfiguration(CompleteConfiguration.class).isStoreByValue();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isStatisticsEnabled() {
+        return cache.getConfiguration(CompleteConfiguration.class).isStatisticsEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isManagementEnabled() {
+        return cache.getConfiguration(CompleteConfiguration.class).isManagementEnabled();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a9d57a3/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index 5514a97..fd383ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -362,5 +362,4 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K,
V>, IgniteAsyncS
      * @return Cache metrics.
      */
     public CacheMetricsMxBean metrics();
-    
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a9d57a3/modules/core/src/main/java/org/apache/ignite/IgniteCacheMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCacheMXBean.java b/modules/core/src/main/java/org/apache/ignite/IgniteCacheMXBean.java
deleted file mode 100644
index 0c9d943..0000000
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCacheMXBean.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite;
-
-import javax.cache.*;
-import javax.cache.configuration.*;
-import javax.cache.management.*;
-
-/**
- * Implementation of {@link CacheMXBean}.
- *
- * It's a simple wrapper around {@link CompleteConfiguration CompleteConfiguration} for readonly
- * access to cache configuration.
- */
-public class IgniteCacheMXBean implements CacheMXBean {
-    /** */
-    private final Cache<?, ?> cache;
-
-    /**
-     * @param cache Cache.
-     */
-    public IgniteCacheMXBean(Cache<?, ?> cache) {
-        this.cache = cache;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String getKeyType() {
-        return cache.getConfiguration(CompleteConfiguration.class).getKeyType().getName();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String getValueType() {
-        return cache.getConfiguration(CompleteConfiguration.class).getValueType().getName();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isReadThrough() {
-        return cache.getConfiguration(CompleteConfiguration.class).isReadThrough();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isWriteThrough() {
-        return cache.getConfiguration(CompleteConfiguration.class).isWriteThrough();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isStoreByValue() {
-        return cache.getConfiguration(CompleteConfiguration.class).isStoreByValue();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isStatisticsEnabled() {
-        return cache.getConfiguration(CompleteConfiguration.class).isStatisticsEnabled();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isManagementEnabled() {
-        return cache.getConfiguration(CompleteConfiguration.class).isManagementEnabled();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a9d57a3/modules/core/src/main/java/org/apache/ignite/IgniteCacheManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCacheManager.java b/modules/core/src/main/java/org/apache/ignite/IgniteCacheManager.java
index c4c329a..d5f4d1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCacheManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCacheManager.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite;
 
-import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.lang.*;
 import org.gridgain.grid.cache.*;
@@ -42,7 +41,7 @@ public class IgniteCacheManager implements CacheManager {
     private static final String CACHE_CONFIGURATION = "CacheConfiguration";
 
     /** */
-    private final Map<String, IgniteBiTuple<Ignite, IgniteCacheMXBean>> igniteMap
= new HashMap<>();
+    private final Map<String, IgniteBiTuple<Ignite, CacheMXBeanImpl>> igniteMap
= new HashMap<>();
 
     /** */
     private final URI uri;
@@ -148,7 +147,7 @@ public class IgniteCacheManager implements CacheManager {
 
             res = ignite.jcache(cacheName);
 
-            igniteMap.put(cacheName, new T2<>(ignite, new IgniteCacheMXBean(res)));
+            igniteMap.put(cacheName, new T2<>(ignite, new CacheMXBeanImpl(res)));
         }
 
         if (((CompleteConfiguration)cacheCfg).isManagementEnabled())
@@ -164,7 +163,7 @@ public class IgniteCacheManager implements CacheManager {
      * @param cacheName Cache name.
      */
     private <K, V> IgniteCache<K, V> findCache(String cacheName) {
-        IgniteBiTuple<Ignite, IgniteCacheMXBean> tuple;
+        IgniteBiTuple<Ignite, CacheMXBeanImpl> tuple;
 
         synchronized (igniteMap) {
             tuple = igniteMap.get(cacheName);
@@ -230,7 +229,7 @@ public class IgniteCacheManager implements CacheManager {
      */
     public boolean isManagedIgnite(Ignite ignite) {
         synchronized (igniteMap) {
-            for (IgniteBiTuple<Ignite, IgniteCacheMXBean> tuple : igniteMap.values())
{
+            for (IgniteBiTuple<Ignite, CacheMXBeanImpl> tuple : igniteMap.values())
{
                 if (ignite.equals(tuple.get1()))
                     return true;
             }
@@ -246,7 +245,7 @@ public class IgniteCacheManager implements CacheManager {
         if (cacheName == null)
             throw new NullPointerException();
 
-        IgniteBiTuple<Ignite, IgniteCacheMXBean> tuple;
+        IgniteBiTuple<Ignite, CacheMXBeanImpl> tuple;
 
         synchronized (igniteMap) {
             tuple = igniteMap.remove(cacheName);
@@ -291,7 +290,7 @@ public class IgniteCacheManager implements CacheManager {
         if (cacheName == null)
             throw new NullPointerException();
 
-        IgniteBiTuple<Ignite, IgniteCacheMXBean> tuple;
+        IgniteBiTuple<Ignite, CacheMXBeanImpl> tuple;
 
         synchronized (igniteMap) {
             tuple = igniteMap.get(cacheName);
@@ -303,7 +302,8 @@ public class IgniteCacheManager implements CacheManager {
             registerCacheObject(mBeanSrv, tuple.get2(), cacheName, CACHE_CONFIGURATION);
 
             tuple.get1().cache(cacheName).configuration().setManagementEnabled(true);
-        } else {
+        }
+        else {
             unregisterCacheObject(mBeanSrv, cacheName, CACHE_CONFIGURATION);
 
             tuple.get1().cache(cacheName).configuration().setManagementEnabled(false);
@@ -318,7 +318,7 @@ public class IgniteCacheManager implements CacheManager {
         if (cacheName == null)
             throw new NullPointerException();
 
-        IgniteBiTuple<Ignite, IgniteCacheMXBean> tuple;
+        IgniteBiTuple<Ignite, CacheMXBeanImpl> tuple;
 
         synchronized (igniteMap) {
             tuple = igniteMap.get(cacheName);
@@ -388,7 +388,7 @@ public class IgniteCacheManager implements CacheManager {
                 mBeanSrv.unregisterMBean(registeredObjectName);
             } catch (Exception e) {
                 throw new CacheException("Error unregistering object instance " + registeredObjectName
-                        + " . Error was " + e.getMessage(), e);
+                    + " . Error was " + e.getMessage(), e);
             }
         }
     }
@@ -404,13 +404,13 @@ public class IgniteCacheManager implements CacheManager {
     /** {@inheritDoc} */
     @Override public void close() {
         if (closed.compareAndSet(false, true)) {
-            IgniteBiTuple<Ignite, IgniteCacheMXBean>[] ignites;
+            IgniteBiTuple<Ignite, CacheMXBeanImpl>[] ignites;
 
             synchronized (igniteMap) {
                 ignites = igniteMap.values().toArray(new IgniteBiTuple[igniteMap.values().size()]);
             }
 
-            for (IgniteBiTuple<Ignite, IgniteCacheMXBean> tuple : ignites) {
+            for (IgniteBiTuple<Ignite, CacheMXBeanImpl> tuple : ignites) {
                 try {
                     tuple.get1().close();
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a9d57a3/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
index c5c1b2b..3f9bbd9 100644
--- 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
@@ -21,9 +21,9 @@ import org.gridgain.grid.cache.*;
 import org.gridgain.grid.util.tostring.*;
 import org.gridgain.grid.util.typedef.internal.*;
 
-import javax.cache.management.CacheStatisticsMXBean;
+import javax.cache.management.*;
 import java.io.*;
-import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.*;
 
 /**
  * Adapter for cache metrics.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a9d57a3/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 311accd..e25949b 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
@@ -5304,7 +5304,8 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
 
                     updateTimeStat();
                 }
-            } catch (IgniteCheckedException ignore) {
+            }
+            catch (IgniteCheckedException ignore) {
                 //No-op.
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a9d57a3/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 f1e9c51..6152398 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
@@ -116,9 +116,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
     @Override protected void init() {
         map.setEntryFactory(new GridCacheMapEntryFactory<K, V>() {
             /** {@inheritDoc} */
-            @Override
-            public GridCacheMapEntry<K, V> create(GridCacheContext<K, V> ctx,
long topVer, K key, int hash,
-                                                  V val, GridCacheMapEntry<K, V> next,
long ttl, int hdrId) {
+            @Override public GridCacheMapEntry<K, V> create(GridCacheContext<K,
V> ctx, long topVer, K key, int hash,
+                V val, GridCacheMapEntry<K, V> next, long ttl, int hdrId) {
                 return new GridDhtAtomicCacheEntry<>(ctx, topVer, key, hash, val, next,
ttl, hdrId);
             }
         });


Mime
View raw message