You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/01/12 12:06:23 UTC
[2/4] incubator-ignite git commit: GG-9673 Need to investigate MBeans
registration in Weblogic cluster environment Added jvmId property to mbean
name.
GG-9673 Need to investigate MBeans registration in Weblogic cluster environment Added jvmId property to mbean name.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a7b426cf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a7b426cf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a7b426cf
Branch: refs/heads/ignite-1
Commit: a7b426cffe243ad6270a06bc251e283acf3a5b43
Parents: 5fd0d7c
Author: sevdokimov <se...@gridgain.com>
Authored: Mon Jan 12 12:48:55 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Mon Jan 12 12:48:55 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/IgniteSystemProperties.java | 13 +++++++++++++
.../main/java/org/gridgain/grid/util/GridUtils.java | 16 ++++++++++++++++
2 files changed, 29 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a7b426cf/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index c403fd7..b4d9d81 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -12,6 +12,7 @@ package org.apache.ignite;
import org.jetbrains.annotations.*;
import javax.net.ssl.*;
+import java.lang.management.*;
/**
* Contains constants for all system properties and environmental variables in GridGain. These
@@ -448,6 +449,18 @@ public final class IgniteSystemProperties {
public static final String GG_WORK_DIR = "GRIDGAIN_WORK_DIR";
/**
+ * If this property is set to {@code true} then GridGain will append
+ * hash code of {@link Ignite} class as hex string and append
+ * JVM name returned by {@link RuntimeMXBean#getName()}.
+ * <p>
+ * This may be helpful when running GridGain in some application server
+ * clusters or similar environments to avoid MBean name collisions.
+ * <p>
+ * Default is {@code false}.
+ */
+ public static final String GG_MBEAN_APPEND_JVM_ID = "GRIDGAIN_MBEAN_APPEND_JVM_ID";
+
+ /**
* Enforces singleton.
*/
private IgniteSystemProperties() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a7b426cf/modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java b/modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java
index 37c2109..62d27d3 100644
--- a/modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java
+++ b/modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java
@@ -3867,6 +3867,8 @@ public abstract class GridUtils {
throws MalformedObjectNameException {
SB sb = new SB(JMX_DOMAIN + ':');
+ appendJvmId(sb);
+
if (gridName != null && !gridName.isEmpty())
sb.a("grid=").a(gridName).a(',');
@@ -3879,6 +3881,18 @@ public abstract class GridUtils {
}
/**
+ * @param sb Sb.
+ */
+ private static void appendJvmId(SB sb) {
+ if (getBoolean(GG_MBEAN_APPEND_JVM_ID)) {
+ String gridId = Integer.toHexString(Ignite.class.getClassLoader().hashCode()) + "_"
+ + ManagementFactory.getRuntimeMXBean().getName();
+
+ sb.a("jvmId=").a(gridId).a(',');
+ }
+ }
+
+ /**
* Mask component name to make sure that it is not {@code null}.
*
* @param cacheName Component name to mask, possibly {@code null}.
@@ -3902,6 +3916,8 @@ public abstract class GridUtils {
throws MalformedObjectNameException {
SB sb = new SB(JMX_DOMAIN + ':');
+ appendJvmId(sb);
+
if (gridName != null && !gridName.isEmpty())
sb.a("grid=").a(gridName).a(',');