ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [02/24] incubator-ignite git commit: # GG-9942 Fixed Visor logic after DR was reworked.
Date Thu, 02 Apr 2015 12:35:17 GMT
# GG-9942 Fixed Visor logic after DR was reworked.


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

Branch: refs/heads/ignite-gg-10009-2
Commit: c8428a453bdee6da2fa0a6221d53c41f157f4e45
Parents: b05b06f
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Wed Apr 1 18:12:43 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Wed Apr 1 18:12:43 2015 +0700

----------------------------------------------------------------------
 .../visor/cache/VisorCacheConfiguration.java    | 81 ++++++++------------
 .../visor/node/VisorGridConfiguration.java      | 28 ++++++-
 2 files changed, 58 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c8428a45/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index 98a8bc2..923fedd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -121,56 +121,37 @@ public class VisorCacheConfiguration implements Serializable {
      * @param ccfg Cache configuration.
      * @return Data transfer object for cache configuration properties.
      */
-    public static VisorCacheConfiguration from(Ignite ignite, CacheConfiguration ccfg) {
-        VisorCacheConfiguration cfg = new VisorCacheConfiguration();
-
-        cfg.name = ccfg.getName();
-        cfg.mode = ccfg.getCacheMode();
-        cfg.atomicityMode = ccfg.getAtomicityMode();
-        cfg.atomicWriteOrderMode = ccfg.getAtomicWriteOrderMode();
-        cfg.eagerTtl = ccfg.isEagerTtl();
-        cfg.writeSynchronizationMode = ccfg.getWriteSynchronizationMode();
-        cfg.swapEnabled = ccfg.isSwapEnabled();
-        cfg.invalidate = ccfg.isInvalidate();
-        cfg.startSize = ccfg.getStartSize();
-        cfg.tmLookupClsName = ccfg.getTransactionManagerLookupClassName();
-        cfg.offHeapMaxMemory = ccfg.getOffHeapMaxMemory();
-        cfg.maxConcurrentAsyncOps = ccfg.getMaxConcurrentAsyncOperations();
-        cfg.memoryMode = ccfg.getMemoryMode();
-        cfg.interceptor = compactClass(ccfg.getInterceptor());
-        cfg.typeMeta = VisorCacheTypeMetadata.list(ccfg.getTypeMetadata());
-        cfg.statisticsEnabled = ccfg.isStatisticsEnabled();
-        cfg.mgmtEnabled = ccfg.isManagementEnabled();
-        cfg.ldrFactory = compactClass(ccfg.getCacheLoaderFactory());
-        cfg.writerFactory = compactClass(ccfg.getCacheWriterFactory());
-        cfg.expiryPlcFactory = compactClass(ccfg.getExpiryPolicyFactory());
-
-        cfg.affinityCfg = VisorCacheAffinityConfiguration.from(ccfg);
-        cfg.rebalanceCfg = VisorCacheRebalanceConfiguration.from(ccfg);
-        cfg.evictCfg = VisorCacheEvictionConfiguration.from(ccfg);
-        cfg.nearCfg = VisorCacheNearConfiguration.from(ccfg);
-        cfg.dfltCfg = VisorCacheDefaultConfiguration.from(ccfg);
-        cfg.storeCfg = VisorCacheStoreConfiguration.from(ignite, ccfg);
-        cfg.qryCfg = VisorCacheQueryConfiguration.from(ccfg);
-
-        return cfg;
-    }
-
-    /**
-     * @param ignite Grid.
-     * @param caches Cache configurations.
-     * @return Data transfer object for cache configurations properties.
-     */
-    public static Iterable<VisorCacheConfiguration> list(Ignite ignite, CacheConfiguration[]
caches) {
-        if (caches == null)
-            return Collections.emptyList();
-
-        final Collection<VisorCacheConfiguration> cfgs = new ArrayList<>(caches.length);
-
-        for (CacheConfiguration cache : caches)
-            cfgs.add(from(ignite, cache));
-
-        return cfgs;
+    public VisorCacheConfiguration from(Ignite ignite, CacheConfiguration ccfg) {
+        name = ccfg.getName();
+        mode = ccfg.getCacheMode();
+        atomicityMode = ccfg.getAtomicityMode();
+        atomicWriteOrderMode = ccfg.getAtomicWriteOrderMode();
+        eagerTtl = ccfg.isEagerTtl();
+        writeSynchronizationMode = ccfg.getWriteSynchronizationMode();
+        swapEnabled = ccfg.isSwapEnabled();
+        invalidate = ccfg.isInvalidate();
+        startSize = ccfg.getStartSize();
+        tmLookupClsName = ccfg.getTransactionManagerLookupClassName();
+        offHeapMaxMemory = ccfg.getOffHeapMaxMemory();
+        maxConcurrentAsyncOps = ccfg.getMaxConcurrentAsyncOperations();
+        memoryMode = ccfg.getMemoryMode();
+        interceptor = compactClass(ccfg.getInterceptor());
+        typeMeta = VisorCacheTypeMetadata.list(ccfg.getTypeMetadata());
+        statisticsEnabled = ccfg.isStatisticsEnabled();
+        mgmtEnabled = ccfg.isManagementEnabled();
+        ldrFactory = compactClass(ccfg.getCacheLoaderFactory());
+        writerFactory = compactClass(ccfg.getCacheWriterFactory());
+        expiryPlcFactory = compactClass(ccfg.getExpiryPolicyFactory());
+
+        affinityCfg = VisorCacheAffinityConfiguration.from(ccfg);
+        rebalanceCfg = VisorCacheRebalanceConfiguration.from(ccfg);
+        evictCfg = VisorCacheEvictionConfiguration.from(ccfg);
+        nearCfg = VisorCacheNearConfiguration.from(ccfg);
+        dfltCfg = VisorCacheDefaultConfiguration.from(ccfg);
+        storeCfg = VisorCacheStoreConfiguration.from(ignite, ccfg);
+        qryCfg = VisorCacheQueryConfiguration.from(ccfg);
+
+        return this;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c8428a45/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
index f6243c1..6548d07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
@@ -106,7 +106,7 @@ public class VisorGridConfiguration implements Serializable {
         inclEvtTypes = c.getIncludeEventTypes();
         rest = VisorRestConfiguration.from(c);
         userAttrs = c.getUserAttributes();
-        caches = VisorCacheConfiguration.list(ignite, c.getCacheConfiguration());
+        caches = collectCaches(ignite, c.getCacheConfiguration());
         igfss = VisorIgfsConfiguration.list(c.getFileSystemConfiguration());
         env = new HashMap<>(System.getenv());
         sysProps = IgniteSystemProperties.snapshot();
@@ -194,6 +194,32 @@ public class VisorGridConfiguration implements Serializable {
     }
 
     /**
+     * @return List of data transfer objects for caches.
+     */
+    private Iterable<VisorCacheConfiguration> collectCaches(IgniteEx ignite, CacheConfiguration[]
ccfgs) {
+        if (ccfgs == null)
+            return Collections.emptyList();
+
+        final Collection<VisorCacheConfiguration> res = new ArrayList<>(ccfgs.length);
+
+        for (CacheConfiguration ccfg : ccfgs)
+            res.add(collectCache(ignite, ccfg));
+
+        return res;
+    }
+
+    /**
+     * Create data transfer object for cache configuration.
+     *
+     * @param ignite Ignite instance.
+     * @param ccfg Cache configuration.
+     * @return Data transfer objects for cache
+     */
+    protected VisorCacheConfiguration collectCache(IgniteEx ignite, CacheConfiguration ccfg)
{
+        return new VisorCacheConfiguration().from(ignite, ccfg);
+    }
+
+    /**
      * @return Caches.
      */
     public Iterable<VisorCacheConfiguration> caches() {


Mime
View raw message