ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [16/22] ignite git commit: IGNITE-3061: Platforms: now Spring context is propagated correctly for platform nodes.
Date Thu, 28 Apr 2016 11:28:17 GMT
IGNITE-3061: Platforms: now Spring context is propagated correctly for platform nodes.


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

Branch: refs/heads/ignite-2523-1
Commit: 22263773313dde6694f41d8eff2cd7af3fb72936
Parents: d081538
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Apr 27 16:42:24 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Apr 27 16:42:24 2016 +0300

----------------------------------------------------------------------
 .../platform/PlatformAbstractBootstrap.java       | 17 ++++++++++++++---
 .../processors/platform/PlatformBootstrap.java    |  6 +++++-
 .../processors/platform/PlatformIgnition.java     | 18 +++++++++---------
 .../utils/PlatformConfigurationUtils.java         |  3 ++-
 4 files changed, 30 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/22263773/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
index 7e71e11..6fc46c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractBootstrap.java
@@ -17,25 +17,36 @@
 
 package org.apache.ignite.internal.processors.platform;
 
+import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.Ignition;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgnitionEx;
 import org.apache.ignite.internal.processors.platform.memory.PlatformExternalMemory;
+import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteClosure;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * Base interop bootstrap implementation.
  */
 public abstract class PlatformAbstractBootstrap implements PlatformBootstrap {
     /** {@inheritDoc} */
-    @Override public PlatformProcessor start(IgniteConfiguration cfg, long envPtr, long dataPtr)
{
+    @Override public PlatformProcessor start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext
springCtx,
+        long envPtr, long dataPtr) {
         Ignition.setClientMode(new PlatformExternalMemory(null, dataPtr).input().readBoolean());
 
         IgniteConfiguration cfg0 = closure(envPtr).apply(cfg);
 
-        IgniteEx node = (IgniteEx) Ignition.start(cfg0);
+        try {
+            IgniteEx node = (IgniteEx)IgnitionEx.start(cfg0, springCtx);
 
-        return node.context().platform();
+            return node.context().platform();
+        }
+        catch (IgniteCheckedException e) {
+            throw U.convertException(e);
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/22263773/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformBootstrap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformBootstrap.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformBootstrap.java
index 9d64649..956a02d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformBootstrap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformBootstrap.java
@@ -18,6 +18,8 @@
 package org.apache.ignite.internal.processors.platform;
 
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * Platform bootstrap. Responsible for starting Ignite node with non-Java platform.
@@ -27,9 +29,11 @@ public interface PlatformBootstrap {
      * Start Ignite node.
      *
      * @param cfg Configuration.
+     * @param springCtx Optional Spring resource context.
      * @param envPtr Environment pointer.
      * @param dataPtr Optional pointer to additional data required for startup.
      * @return Platform processor.
      */
-    public PlatformProcessor start(IgniteConfiguration cfg, long envPtr, long dataPtr);
+    public PlatformProcessor start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext
springCtx,
+        long envPtr, long dataPtr);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/22263773/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
index d25acfc..928aa66 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
@@ -28,6 +28,7 @@ import org.apache.ignite.Ignition;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgnitionEx;
 import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
+import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.jetbrains.annotations.Nullable;
@@ -60,16 +61,16 @@ public class PlatformIgnition {
         Thread.currentThread().setContextClassLoader(PlatformProcessor.class.getClassLoader());
 
         try {
-            IgniteConfiguration cfg = configuration(springCfgPath);
+            IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> cfg = configuration(springCfgPath);
 
             if (gridName != null)
-                cfg.setGridName(gridName);
+                cfg.get1().setGridName(gridName);
             else
-                gridName = cfg.getGridName();
+                gridName = cfg.get1().getGridName();
 
             PlatformBootstrap bootstrap = bootstrap(factoryId);
 
-            PlatformProcessor proc = bootstrap.start(cfg, envPtr, dataPtr);
+            PlatformProcessor proc = bootstrap.start(cfg.get1(), cfg.get2(), envPtr, dataPtr);
 
             PlatformProcessor old = instances.put(gridName, proc);
 
@@ -141,16 +142,15 @@ public class PlatformIgnition {
      * @param springCfgPath Path to Spring XML.
      * @return Configuration.
      */
-    private static IgniteConfiguration configuration(@Nullable String springCfgPath) {
+    private static IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> configuration(
+        @Nullable String springCfgPath) {
         if (springCfgPath == null)
-            return new IgniteConfiguration();
+            return new T2<>(new IgniteConfiguration(), null);
 
         try {
             URL url = U.resolveSpringUrl(springCfgPath);
 
-            IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> t = IgnitionEx.loadConfiguration(url);
-
-            return t.get1();
+            return IgnitionEx.loadConfiguration(url);
         }
         catch (IgniteCheckedException e) {
             throw new IgniteException("Failed to instantiate configuration from Spring XML:
" + springCfgPath, e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/22263773/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 9d7f957..898bcf9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -62,7 +62,8 @@ import java.util.Map;
 /**
  * Configuration utils.
  */
-@SuppressWarnings("unchecked") public class PlatformConfigurationUtils {
+@SuppressWarnings("unchecked")
+public class PlatformConfigurationUtils {
     /**
      * Write .Net configuration to the stream.
      *


Mime
View raw message