ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntikho...@apache.org
Subject incubator-ignite git commit: IGNITE-1108 Fixed reviewe notes.
Date Thu, 23 Jul 2015 13:49:22 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-1108 a05ed1253 -> 0e779a0f7


IGNITE-1108 Fixed reviewe notes.


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

Branch: refs/heads/ignite-1108
Commit: 0e779a0f77ce8c2970d944aea5ff577e6c6eecfa
Parents: a05ed12
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Thu Jul 23 16:49:28 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Thu Jul 23 16:49:28 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    | 18 ---------------
 .../plugin/IgnitePluginProcessor.java           | 24 +++++++++++++++++---
 .../apache/ignite/plugin/PluginProvider.java    |  3 ++-
 .../ignite/plugin/PluginProviderAdapter.java    |  2 +-
 .../internal/util/TestPluginProvider.java       |  2 +-
 5 files changed, 25 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0e779a0f/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 5eced59..024dc7b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -1801,24 +1801,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
                 }
             }
 
-            // TODO: This should be inside IgnitePluginProcessor.stop() I think.
-            // Invoke callback on plugins.
-            if (ctx.plugins() != null && ctx.plugins().allProviders() != null) {
-                for (PluginProvider plugin : ctx.plugins().allProviders()) {
-                    try {
-                        plugin.onAfterStop(cancel);
-                    }
-                    catch (Throwable e) {
-                        errOnStop = true;
-
-                        U.error(log, "Failed to invoke afterStop for plugin (ignoring): "
+ plugin, e);
-
-                        if (e instanceof Error)
-                            throw (Error)e;
-                    }
-                }
-            }
-
             // Stops lifecycle aware components.
             U.stopLifecycleAware(log, lifecycleAwares(cfg));
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0e779a0f/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 fe551b5..aa9778f 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
@@ -132,14 +132,32 @@ public class IgnitePluginProcessor extends GridProcessorAdapter {
 
     /** {@inheritDoc} */
     @Override public void start() throws IgniteCheckedException {
-        for (PluginProvider plugin : plugins.values())
-            // TODO: Why not passing PluginContext here? We already have it at that point.
-            plugin.onBeforeStart();
+        for (Map.Entry<PluginProvider, GridPluginContext> e : pluginCtxMap.entrySet())
+            e.getKey().onBeforeStart(e.getValue());
 
         ackPluginsInfo();
     }
 
     /** {@inheritDoc} */
+    @Override public void stop(boolean cancel) throws IgniteCheckedException {
+        boolean errOnStop = false;
+
+        for (PluginProvider plugin : plugins.values()) {
+            try {
+                plugin.onAfterStop(cancel);
+            }
+            catch (Exception e) {
+                errOnStop = true;
+
+                U.error(log, "Failed to invoke afterStop for plugin (ignoring): " + plugin,
e);
+            }
+        }
+
+        if (errOnStop)
+            throw new IgniteCheckedException("Failed to stop plugins.");
+    }
+
+    /** {@inheritDoc} */
     @Nullable @Override public DiscoveryDataExchangeType discoveryDataType() {
         return DiscoveryDataExchangeType.PLUGIN;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0e779a0f/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java b/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
index a020991..e1e39c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
@@ -77,9 +77,10 @@ public interface PluginProvider<C extends PluginConfiguration> {
     /**
      * Callback that notifies that Ignite prepares to start plugin.
      *
+     * @param ctx Plugin context.
      * @throws IgniteCheckedException Thrown in case of any errors.
      */
-    public void onBeforeStart() throws IgniteCheckedException;
+    public void onBeforeStart(PluginContext ctx) throws IgniteCheckedException;
 
     /**
      * Starts grid component.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0e779a0f/modules/core/src/main/java/org/apache/ignite/plugin/PluginProviderAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/PluginProviderAdapter.java
b/modules/core/src/main/java/org/apache/ignite/plugin/PluginProviderAdapter.java
index bef7000..06d4973 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/PluginProviderAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/PluginProviderAdapter.java
@@ -59,7 +59,7 @@ public class PluginProviderAdapter<C extends PluginConfiguration>
implements Plu
     }
 
     /** {@inheritDoc} */
-    @Override public void onBeforeStart() throws IgniteCheckedException {
+    @Override public void onBeforeStart(PluginContext ctx) throws IgniteCheckedException
{
         // No-op.
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0e779a0f/modules/core/src/test/java/org/apache/ignite/internal/util/TestPluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/TestPluginProvider.java
b/modules/core/src/test/java/org/apache/ignite/internal/util/TestPluginProvider.java
index 3e15a88..98bd974 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/TestPluginProvider.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/TestPluginProvider.java
@@ -50,7 +50,7 @@ public class TestPluginProvider extends PluginProviderAdapter<TestPluginProvider
     }
 
     /** {@inheritDoc} */
-    @Override public void onBeforeStart() throws IgniteCheckedException {
+    @Override public void onBeforeStart(PluginContext ctx) throws IgniteCheckedException
{
         if (enableAssert) {
             bfStart = true;
 


Mime
View raw message