ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: ignite-598
Date Mon, 30 Mar 2015 16:32:07 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-598 4b5204bab -> d0d98cf12


ignite-598


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

Branch: refs/heads/ignite-598
Commit: d0d98cf12f480e72bafb9dc2ab20d67523795e26
Parents: 4b5204b
Author: Artem Shutak <ashutak@gridgain.com>
Authored: Mon Mar 30 19:31:45 2015 +0300
Committer: Artem Shutak <ashutak@gridgain.com>
Committed: Mon Mar 30 19:31:45 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridCachePluginContext.java |  9 ++-
 .../ignite/internal/GridKernalContextImpl.java  |  8 +--
 .../processors/cache/GridCacheProcessor.java    |  4 +-
 .../processors/plugin/CachePluginManager.java   | 39 +++++++++++
 .../plugin/IgnitePluginProcessor.java           |  6 ++
 .../ignite/plugin/CachePluginContext.java       |  2 +
 .../loadtests/hashmap/GridCacheTestContext.java | 68 ++++++++------------
 7 files changed, 87 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0d98cf1/modules/core/src/main/java/org/apache/ignite/internal/GridCachePluginContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridCachePluginContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/GridCachePluginContext.java
index 140f4f4..98af173 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridCachePluginContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridCachePluginContext.java
@@ -60,11 +60,18 @@ public class GridCachePluginContext<C extends CachePluginConfiguration>
implemen
     }
 
     /** {@inheritDoc} */
-    @Override public Ignite grid() {
+    @Override public Ignite grid() {        
         return ctx.grid();
     }
 
     /** {@inheritDoc} */
+    @Override public <T extends PluginContext> T pluginContext(String name) {
+        PluginProvider provider = ctx.plugins().pluginProvider(name);
+        
+        return ctx.plugins().pluginContextForProvider(provider);
+    }
+
+    /** {@inheritDoc} */
     @Override public Collection<ClusterNode> nodes() {
         return ctx.discovery().allNodes();
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0d98cf1/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 0c3f41f..a3e3971 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -31,8 +31,6 @@ import org.apache.ignite.internal.managers.loadbalancer.*;
 import org.apache.ignite.internal.managers.swapspace.*;
 import org.apache.ignite.internal.processors.affinity.*;
 import org.apache.ignite.internal.processors.cache.*;
-import org.apache.ignite.internal.processors.cache.dr.*;
-import org.apache.ignite.internal.processors.cache.dr.os.*;
 import org.apache.ignite.internal.processors.cacheobject.*;
 import org.apache.ignite.internal.processors.clock.*;
 import org.apache.ignite.internal.processors.closure.*;
@@ -57,8 +55,8 @@ import org.apache.ignite.internal.processors.service.*;
 import org.apache.ignite.internal.processors.session.*;
 import org.apache.ignite.internal.processors.task.*;
 import org.apache.ignite.internal.processors.timeout.*;
-import org.apache.ignite.internal.util.spring.*;
 import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.spring.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
@@ -787,9 +785,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
         if (res != null)
             return res;
 
-        if (cls.equals(GridCacheDrManager.class))
-            return (T)new GridOsCacheDrManager();
-        else if (cls.equals(IgniteCacheObjectProcessor.class))
+        if (cls.equals(IgniteCacheObjectProcessor.class))
             return (T)new IgniteCacheObjectProcessorImpl(this);
 
         throw new IgniteException("Unsupported component type: " + cls);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0d98cf1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 08daa2e..ebc875d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1014,8 +1014,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         CacheContinuousQueryManager contQryMgr = new CacheContinuousQueryManager();
         CacheDataStructuresManager dataStructuresMgr = new CacheDataStructuresManager();
         GridCacheTtlManager ttlMgr = new GridCacheTtlManager();
-        GridCacheDrManager drMgr = ctx.createComponent(GridCacheDrManager.class);
         CachePluginManager cachePluginMgr = new CachePluginManager(ctx, cfg);
+        GridCacheDrManager drMgr = cachePluginMgr.createComponent(GridCacheDrManager.class);
 
         GridCacheStoreManager storeMgr = new GridCacheStoreManager(ctx, sesHolders, cfgStore,
cfg);
 
@@ -1142,7 +1142,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             swapMgr = new GridCacheSwapManager(true);
             evictMgr = new GridCacheEvictionManager();
             evtMgr = new GridCacheEventManager();
-            drMgr = ctx.createComponent(GridCacheDrManager.class);
+            drMgr = cachePluginMgr.createComponent(GridCacheDrManager.class);
             cachePluginMgr = new CachePluginManager(ctx, cfg);
 
             cacheCtx = new GridCacheContext(

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0d98cf1/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
index afb941a..a828122 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
@@ -21,6 +21,8 @@ import org.apache.ignite.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.dr.*;
+import org.apache.ignite.internal.processors.cache.dr.os.*;
 import org.apache.ignite.plugin.*;
 
 import java.util.*;
@@ -70,4 +72,41 @@ public class CachePluginManager extends GridCacheManagerAdapter {
         for (ListIterator<CachePluginProvider> iter = providers.listIterator(); iter.hasPrevious();)
             iter.previous().stop(cancel);
     }
+
+    /**
+     * @param cfg Cache configuration.
+     * @param cl Type of cache plugin configuration.
+     * @return Cache plugin configuration by type from cache configuration or <code>null</code>.
+     */
+    public static <C extends CachePluginConfiguration> C cachePluginConfig(
+        CacheConfiguration cfg, Class<C> cl) {
+        for (CachePluginConfiguration pluginCfg : cfg.getCachePluginConfigurations()) {
+            if (pluginCfg.getClass() == cl)
+                return (C)pluginCfg;
+        }
+        
+        return null;
+    }
+
+
+    /**
+     * Creates optional component.
+     *
+     * @param cls Component class.
+     * @return Created component.
+     */
+    public <T> T createComponent(Class<T> cls) {
+        for (CachePluginProvider provider : providers) {
+            T res = (T)provider.createComponent(cls);
+            
+            if (res != null)
+                return res;
+        }
+        
+        if (cls.equals(GridCacheDrManager.class))
+            return (T)new GridOsCacheDrManager();
+        
+        throw new IgniteException("Unsupported component type: " + cls);
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0d98cf1/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
index bf5d61f..cb06d3b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
@@ -123,6 +123,12 @@ public class IgnitePluginProcessor extends GridProcessorAdapter {
     @Nullable public <T extends PluginProvider> T pluginProvider(String name) {
         return (T)plugins.get(name);
     }
+    
+    public <T extends PluginContext> T pluginContext(String name) {
+        PluginProvider provider = pluginProvider(name);
+
+        return (T)pluginCtxMap.get(provider);
+    } 
 
     /**
      * @return All plugin providers.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0d98cf1/modules/core/src/main/java/org/apache/ignite/plugin/CachePluginContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/CachePluginContext.java b/modules/core/src/main/java/org/apache/ignite/plugin/CachePluginContext.java
index 5eb2442..6e6b99c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/CachePluginContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/CachePluginContext.java
@@ -42,6 +42,8 @@ public interface CachePluginContext<C extends CachePluginConfiguration>
{
      */
     public Ignite grid();
 
+    public <T extends PluginContext> T pluginContext(String name);
+
     /**
      * Gets a collection of all grid nodes. Remote nodes are discovered via underlying
      * {@link org.apache.ignite.spi.discovery.DiscoverySpi} implementation used.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0d98cf1/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
index 826617d..486f7df 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
@@ -17,22 +17,9 @@
 
 package org.apache.ignite.loadtests.hashmap;
 
-import org.apache.ignite.cache.store.*;
-import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.processors.cache.*;
-import org.apache.ignite.internal.processors.cache.datastructures.*;
-import org.apache.ignite.internal.processors.cache.dr.os.*;
-import org.apache.ignite.internal.processors.cache.jta.*;
-import org.apache.ignite.internal.processors.cache.query.*;
-import org.apache.ignite.internal.processors.cache.query.continuous.*;
-import org.apache.ignite.internal.processors.cache.transactions.*;
-import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.testframework.junits.*;
 
-import java.util.*;
-
-import static org.apache.ignite.testframework.junits.GridAbstractTest.*;
-
 /**
  * Cache test context.
  */
@@ -43,32 +30,33 @@ public class GridCacheTestContext<K, V> extends GridCacheContext<K,
V> {
      */
     @SuppressWarnings("NullableProblems")
     public GridCacheTestContext(GridTestKernalContext ctx) throws Exception {
-        super(
-            ctx,
-            new GridCacheSharedContext<>(
-                ctx,
-                new IgniteTxManager(),
-                new GridCacheVersionManager(),
-                new GridCacheMvccManager(),
-                new GridCacheDeploymentManager<K, V>(),
-                new GridCachePartitionExchangeManager<K, V>(),
-                new GridCacheIoManager()
-            ),
-            defaultCacheConfiguration(),
-            true,
-            new GridCacheEventManager(),
-            new GridCacheSwapManager(false),
-            new GridCacheStoreManager(null,
-                new IdentityHashMap<CacheStore, ThreadLocal>(),
-                null,
-                new CacheConfiguration()),
-            new GridCacheEvictionManager(),
-            new GridCacheLocalQueryManager<K, V>(),
-            new CacheContinuousQueryManager(),
-            new GridCacheAffinityManager(),
-            new CacheDataStructuresManager(),
-            new GridCacheTtlManager(),
-            new GridOsCacheDrManager(),
-            new CacheNoopJtaManager());
+        // TODO fix it.
+//        super(
+//            ctx,
+//            new GridCacheSharedContext<>(
+//                ctx,
+//                new IgniteTxManager(),
+//                new GridCacheVersionManager(),
+//                new GridCacheMvccManager(),
+//                new GridCacheDeploymentManager<K, V>(),
+//                new GridCachePartitionExchangeManager<K, V>(),
+//                new GridCacheIoManager()
+//            ),
+//            defaultCacheConfiguration(),
+//            true,
+//            new GridCacheEventManager(),
+//            new GridCacheSwapManager(false),
+//            new GridCacheStoreManager(null,
+//                new IdentityHashMap<CacheStore, ThreadLocal>(),
+//                null,
+//                new CacheConfiguration()),
+//            new GridCacheEvictionManager(),
+//            new GridCacheLocalQueryManager<K, V>(),
+//            new CacheContinuousQueryManager(),
+//            new GridCacheAffinityManager(),
+//            new CacheDataStructuresManager(),
+//            new GridCacheTtlManager(),
+//            new GridOsCacheDrManager(),
+//            new CacheNoopJtaManager());
     }
 }


Mime
View raw message