ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [30/45] ignite git commit: IGNITE-1888 Start org.apache.ignite.yardstick.IgniteNode with Spring Application context.
Date Tue, 17 Nov 2015 12:54:35 GMT
 IGNITE-1888 Start org.apache.ignite.yardstick.IgniteNode with Spring Application context.


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

Branch: refs/heads/ignite-1282
Commit: 92881e07a561f25db5edd29ca5b9adc2c060d4b5
Parents: 6b158c9
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Wed Nov 11 14:29:22 2015 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Wed Nov 11 14:29:22 2015 +0700

----------------------------------------------------------------------
 .../org/apache/ignite/yardstick/IgniteNode.java | 23 ++++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/92881e07/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
index ea3bd07..93c80d3 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
@@ -22,6 +22,7 @@ import java.net.URL;
 import java.util.Map;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteSpring;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -30,9 +31,11 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.configuration.TransactionConfiguration;
 import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.GenericApplicationContext;
 import org.springframework.core.io.UrlResource;
 import org.yardstickframework.BenchmarkConfiguration;
@@ -73,15 +76,20 @@ public class IgniteNode implements BenchmarkServer {
 
         BenchmarkUtils.jcommander(cfg.commandLineArguments(), args, "<ignite-node>");
 
-        IgniteConfiguration c = loadConfiguration(args.configuration());
+        IgniteBiTuple<IgniteConfiguration, ? extends ApplicationContext> tup = loadConfiguration(args.configuration());
+
+        IgniteConfiguration c = tup.get1();
 
         assert c != null;
 
+        ApplicationContext appCtx = tup.get2();
+
+        assert appCtx != null;
+
         for (CacheConfiguration cc : c.getCacheConfiguration()) {
             // IgniteNode can not run in CLIENT_ONLY mode,
             // except the case when it's used inside IgniteAbstractBenchmark.
-            boolean cl = args.isClientOnly() && !args.isNearCache() && !clientMode
?
-                false : args.isClientOnly();
+            boolean cl = args.isClientOnly() && (args.isNearCache() || clientMode);
 
             if (cl)
                 c.setClientMode(true);
@@ -141,15 +149,16 @@ public class IgniteNode implements BenchmarkServer {
 
         c.setCommunicationSpi(commSpi);
 
-        ignite = Ignition.start(c);
+        ignite = IgniteSpring.start(c, appCtx);
     }
 
     /**
      * @param springCfgPath Spring configuration file path.
-     * @return Grid configuration.
+     * @return Tuple with grid configuration and Spring application context.
      * @throws Exception If failed.
      */
-    private static IgniteConfiguration loadConfiguration(String springCfgPath) throws Exception
{
+    private static IgniteBiTuple<IgniteConfiguration, ? extends ApplicationContext>
loadConfiguration(String springCfgPath)
+        throws Exception {
         URL url;
 
         try {
@@ -191,7 +200,7 @@ public class IgniteNode implements BenchmarkServer {
         if (cfgMap == null || cfgMap.isEmpty())
             throw new Exception("Failed to find ignite configuration in: " + url);
 
-        return cfgMap.values().iterator().next();
+        return new IgniteBiTuple<>(cfgMap.values().iterator().next(), springCtx);
     }
 
     /** {@inheritDoc} */


Mime
View raw message