Repository: incubator-ignite Updated Branches: refs/heads/ignite-776 [created] 06eaccbb5
# ignite-776 WIP Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/06eaccbb Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/06eaccbb Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/06eaccbb Branch: refs/heads/ignite-776 Commit: 06eaccbb5cb069f78317fc8622bfeb367855b098 Parents: a104771 Author: Andrey <anovi...@gridgain.com> Authored: Mon Apr 27 18:06:46 2015 +0700 Committer: Andrey <anovi...@gridgain.com> Committed: Mon Apr 27 18:06:46 2015 +0700 ---------------------------------------------------------------------- .../ignite/internal/GridUpdateNotifier.java | 22 ++++++++-- .../apache/ignite/internal/IgniteKernal.java | 44 ++++++++++---------- 2 files changed, 40 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06eaccbb/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java b/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java index 8210025..4e67d15 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java @@ -21,6 +21,7 @@ import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.worker.*; +import org.apache.ignite.plugin.*; import org.jetbrains.annotations.*; import org.w3c.dom.*; import org.xml.sax.*; @@ -28,6 +29,7 @@ import org.xml.sax.*; import javax.xml.parsers.*; import java.io.*; import java.net.*; +import java.util.*; import java.util.concurrent.*; import static java.net.URLEncoder.*; @@ -72,6 +74,8 @@ class GridUpdateNotifier { /** System properties */ private final String vmProps; + private final Map<String, String> pluginVers; + /** Kernal gateway */ private final GridKernalGateway gw; @@ -83,11 +87,12 @@ class GridUpdateNotifier { * * @param gridName gridName * @param ver Compound Ignite version. - * @param reportOnlyNew Whether or not to report only new version. * @param gw Kernal gateway. + * @param pluginProviders Kernal gateway. + * @param reportOnlyNew Whether or not to report only new version. * @throws IgniteCheckedException If failed. */ - GridUpdateNotifier(String gridName, String ver, GridKernalGateway gw, boolean reportOnlyNew) + GridUpdateNotifier(String gridName, String ver, GridKernalGateway gw, Collection<PluginProvider> pluginProviders, boolean reportOnlyNew) throws IgniteCheckedException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); @@ -108,9 +113,15 @@ class GridUpdateNotifier { url = "http://tiny.cc/updater/update_status_ignite.php"; this.gridName = gridName == null ? "null" : gridName; - this.reportOnlyNew = reportOnlyNew; this.gw = gw; + pluginVers = U.newHashMap(pluginProviders.size()); + + for (PluginProvider provider : pluginProviders) + pluginVers.put("plugin_" + provider.name(), provider.version()); + + this.reportOnlyNew = reportOnlyNew; + vmProps = getSystemProperties(); } catch (ParserConfigurationException e) { @@ -262,6 +273,11 @@ class GridUpdateNotifier { try { String stackTrace = gw != null ? gw.userStackTrace() : null; + SB plugins = new SB(); + + for (Map.Entry<String, String> p : pluginVers.entrySet()) + plugins.a("&").a(p.getKey()).a("=").a(p.getValue()); + String postParams = "gridName=" + encode(gridName, CHARSET) + (!F.isEmpty(UPD_STATUS_PARAMS) ? "&" + UPD_STATUS_PARAMS : "") + http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06eaccbb/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 d9d0e3d..9347216 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 @@ -611,22 +611,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { boolean notifyEnabled = IgniteSystemProperties.getBoolean(IGNITE_UPDATE_NOTIFIER, true); - verChecker = null; - - if (notifyEnabled) { - try { - verChecker = new GridUpdateNotifier(gridName, VER_STR, gw, false); - - verChecker.checkForNewVersion(execSvc, log); - } - catch (IgniteCheckedException e) { - if (log.isDebugEnabled()) - log.debug("Failed to create GridUpdateNotifier: " + e); - } - } - - final GridUpdateNotifier verChecker0 = verChecker; - // Ack 3-rd party licenses location. if (log.isInfoEnabled() && cfg.getIgniteHome() != null) log.info("3-rd party licenses can be found at: " + cfg.getIgniteHome() + File.separatorChar + "libs" + @@ -696,6 +680,20 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { startProcessor(new IgnitePluginProcessor(ctx, cfg)); + verChecker = null; + + if (notifyEnabled) { + try { + verChecker = new GridUpdateNotifier(gridName, VER_STR, gw, ctx.plugins().allProviders(), false); + + verChecker.checkForNewVersion(execSvc, log); + } + catch (IgniteCheckedException e) { + if (log.isDebugEnabled()) + log.debug("Failed to create GridUpdateNotifier: " + e); + } + } + // Off-heap processor has no dependencies. startProcessor(new GridOffHeapProcessor(ctx)); @@ -837,29 +835,29 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { startTime = U.currentTimeMillis(); // Ack latest version information. - if (verChecker0 != null) - verChecker0.reportStatus(log); + if (verChecker != null) + verChecker.reportStatus(log); if (notifyEnabled) { - assert verChecker0 != null; + assert verChecker != null; - verChecker0.reportOnlyNew(true); + verChecker.reportOnlyNew(true); updateNtfTimer = new Timer("ignite-update-notifier-timer"); // Setup periodic version check. updateNtfTimer.scheduleAtFixedRate(new GridTimerTask() { @Override public void safeRun() throws InterruptedException { - verChecker0.topologySize(cluster().nodes().size()); + verChecker.topologySize(cluster().nodes().size()); - verChecker0.checkForNewVersion(execSvc, log); + verChecker.checkForNewVersion(execSvc, log); // Just wait for 10 secs. Thread.sleep(PERIODIC_VER_CHECK_CONN_TIMEOUT); // Report status if one is available. // No-op if status is NOT available. - verChecker0.reportStatus(log); + verChecker.reportStatus(log); } }, PERIODIC_VER_CHECK_DELAY, PERIODIC_VER_CHECK_DELAY); }