You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2016/10/24 18:17:02 UTC
[17/55] [abbrv] [partial] incubator-geode git commit: Added Spotless
plugin to enforce formatting standards. Added Google Java Style guide
formatter templates, removed existing formatter templates.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/AdminDistributedSystemJmxImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/AdminDistributedSystemJmxImpl.java b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/AdminDistributedSystemJmxImpl.java
index 5ff4bfa..1bfddf2 100755
--- a/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/AdminDistributedSystemJmxImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/jmx/internal/AdminDistributedSystemJmxImpl.java
@@ -1,18 +1,16 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.apache.geode.admin.jmx.internal;
@@ -49,26 +47,25 @@ import java.util.concurrent.atomic.AtomicInteger;
/**
* Provides MBean support for managing a GemFire distributed system.
* <p>
- * TODO: refactor to implement DistributedSystem and delegate to instance of
- * DistributedSystemImpl. Wrap all delegate calls w/ e.printStackTrace() since
- * the HttpAdaptor devours them (what to do w/ template methods then?)
+ * TODO: refactor to implement DistributedSystem and delegate to instance of DistributedSystemImpl.
+ * Wrap all delegate calls w/ e.printStackTrace() since the HttpAdaptor devours them (what to do w/
+ * template methods then?)
*
- * @since GemFire 3.5
+ * @since GemFire 3.5
*/
-public class AdminDistributedSystemJmxImpl
- extends AdminDistributedSystemImpl
- implements ManagedResource, DistributedSystemConfig, StatAlertsAggregator {
+public class AdminDistributedSystemJmxImpl extends AdminDistributedSystemImpl
+ implements ManagedResource, DistributedSystemConfig, StatAlertsAggregator {
private static final Logger logger = LogService.getLogger();
-
+
private Properties mailProps;
// The file name where the StatAlertDefinitions would be serialized
private String statAlertDefnSerFile = System.getProperty("user.dir");
-
- /**
- * Simple counter incrementing on each notification. This this currently
- * resets at every restart of Agent
+
+ /**
+ * Simple counter incrementing on each notification. This this currently resets at every restart
+ * of Agent
*/
private final AtomicInteger notificationSequenceNumber = new AtomicInteger();
@@ -78,8 +75,7 @@ public class AdminDistributedSystemJmxImpl
private volatile boolean isRmiClientCountZero;
/**
- * Variable to indicate if Statistics Alert definitions could be persisted
- * across runs/sessions.
+ * Variable to indicate if Statistics Alert definitions could be persisted across runs/sessions.
*/
private volatile boolean canPersistStatAlertDefs = true;
@@ -87,15 +83,13 @@ public class AdminDistributedSystemJmxImpl
private CacheAndRegionListenerImpl cacheRegionListener;
// -------------------------------------------------------------------------
- // Constructor(s)
+ // Constructor(s)
// -------------------------------------------------------------------------
-
+
/**
- * Constructs new DistributedSystemJmxImpl and registers an MBean to represent
- * it.
+ * Constructs new DistributedSystemJmxImpl and registers an MBean to represent it.
*
- * @param config
- * configuration defining the JMX agent.
+ * @param config configuration defining the JMX agent.
*/
public AdminDistributedSystemJmxImpl(AgentConfigImpl config)
throws org.apache.geode.admin.AdminException {
@@ -116,12 +110,9 @@ public class AdminDistributedSystemJmxImpl
private void initMailProps(AgentConfigImpl config) {
mailProps = new Properties();
- mailProps.put(MailManager.PROPERTY_MAIL_FROM,
- config.getEmailNotificationFrom());
- mailProps.put(MailManager.PROPERTY_MAIL_HOST,
- config.getEmailNotificationHost());
- mailProps.put(MailManager.PROPERTY_MAIL_TO_LIST,
- config.getEmailNotificationToList());
+ mailProps.put(MailManager.PROPERTY_MAIL_FROM, config.getEmailNotificationFrom());
+ mailProps.put(MailManager.PROPERTY_MAIL_HOST, config.getEmailNotificationHost());
+ mailProps.put(MailManager.PROPERTY_MAIL_TO_LIST, config.getEmailNotificationToList());
}
private void initStateSaveFile(AgentConfigImpl agentConfig) {
@@ -129,23 +120,23 @@ public class AdminDistributedSystemJmxImpl
AgentConfigImpl impl = (AgentConfigImpl) agentConfig;
File propFile = impl.getPropertyFile();
- if (propFile!=null) {
- if (propFile.isDirectory()) {
- statAlertDefnSerFile = propFile.getAbsolutePath();
- } else if (propFile.getParentFile()!=null) {
- statAlertDefnSerFile = propFile.getParentFile().getAbsolutePath();
- }
+ if (propFile != null) {
+ if (propFile.isDirectory()) {
+ statAlertDefnSerFile = propFile.getAbsolutePath();
+ } else if (propFile.getParentFile() != null) {
+ statAlertDefnSerFile = propFile.getParentFile().getAbsolutePath();
+ }
}
statAlertDefnSerFile = statAlertDefnSerFile + File.separator + agentConfig.getStateSaveFile();
}
-
+
// -------------------------------------------------------------------------
- // MBean operations
+ // MBean operations
// -------------------------------------------------------------------------
-
+
/**
- * Registers the MBeans for monitoring the health of GemFire
+ * Registers the MBeans for monitoring the health of GemFire
*
* @see org.apache.geode.admin.internal.AdminDistributedSystemImpl#getGemFireHealth
*/
@@ -156,49 +147,37 @@ public class AdminDistributedSystemJmxImpl
}
/**
- * Creates a new DistributionLocator for this system and registers an MBean
- * for managing it.
+ * Creates a new DistributionLocator for this system and registers an MBean for managing it.
* <p>
- * If the Locator already exists, then this will simply register an MBean
- * for it.
+ * If the Locator already exists, then this will simply register an MBean for it.
*
- * @param host the host name or IP address of the locator
- * @param port the port the locator service listens on
- * @param workingDirectory directory path for the locator and its log
- * @param productDirectory directory path to the GemFire product to use
+ * @param host the host name or IP address of the locator
+ * @param port the port the locator service listens on
+ * @param workingDirectory directory path for the locator and its log
+ * @param productDirectory directory path to the GemFire product to use
*/
- public ObjectName createDistributionLocator(String host,
- int port,
- String workingDirectory,
- String productDirectory)
- throws MalformedObjectNameException {
- return createDistributionLocator(
- host, port, workingDirectory, productDirectory, getRemoteCommand());
- }
-
+ public ObjectName createDistributionLocator(String host, int port, String workingDirectory,
+ String productDirectory) throws MalformedObjectNameException {
+ return createDistributionLocator(host, port, workingDirectory, productDirectory,
+ getRemoteCommand());
+ }
+
/**
- * Creates a new DistributionLocator for this system and registers an MBean
- * for managing it.
+ * Creates a new DistributionLocator for this system and registers an MBean for managing it.
* <p>
- * If the Locator already exists, then this will simply register an MBean
- * for it.
+ * If the Locator already exists, then this will simply register an MBean for it.
*
- * @param host the host name or IP address of the locator
- * @param port the port the locator service listens on
- * @param workingDirectory directory path for the locator and its log
- * @param productDirectory directory path to the GemFire product to use
- * @param remoteCommand formatted remote command to control remotely
+ * @param host the host name or IP address of the locator
+ * @param port the port the locator service listens on
+ * @param workingDirectory directory path for the locator and its log
+ * @param productDirectory directory path to the GemFire product to use
+ * @param remoteCommand formatted remote command to control remotely
*/
- public ObjectName createDistributionLocator(String host,
- int port,
- String workingDirectory,
- String productDirectory,
- String remoteCommand)
- throws MalformedObjectNameException {
+ public ObjectName createDistributionLocator(String host, int port, String workingDirectory,
+ String productDirectory, String remoteCommand) throws MalformedObjectNameException {
try {
- DistributionLocatorJmxImpl locator =
- (DistributionLocatorJmxImpl) addDistributionLocator();
-
+ DistributionLocatorJmxImpl locator = (DistributionLocatorJmxImpl) addDistributionLocator();
+
DistributionLocatorConfig config = locator.getConfig();
config.setHost(host);
config.setPort(port);
@@ -212,12 +191,12 @@ public class AdminDistributedSystemJmxImpl
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -226,28 +205,26 @@ public class AdminDistributedSystemJmxImpl
throw e;
}
}
-
+
// -------------------------------------------------------------------------
- // Template methods overriden from superclass...
+ // Template methods overriden from superclass...
// -------------------------------------------------------------------------
-
+
/** Override createSystemMember by instantiating SystemMemberJmxImpl */
@Override
protected SystemMember createSystemMember(ApplicationVM app)
- throws org.apache.geode.admin.AdminException {
+ throws org.apache.geode.admin.AdminException {
return new SystemMemberJmxImpl(this, app);
}
/**
- * Constructs & returns a SystemMember instance using the corresponding
- * InternalDistributedMember object.
+ * Constructs & returns a SystemMember instance using the corresponding InternalDistributedMember
+ * object.
*
- * @param member
- * InternalDistributedMember instance for which a SystemMember
- * instance is to be constructed.
+ * @param member InternalDistributedMember instance for which a SystemMember instance is to be
+ * constructed.
* @return constructed SystemMember instance
- * @throws org.apache.geode.admin.AdminException
- * if construction of SystemMember instance fails
+ * @throws org.apache.geode.admin.AdminException if construction of SystemMember instance fails
*
* @since GemFire 6.5
*/
@@ -255,43 +232,43 @@ public class AdminDistributedSystemJmxImpl
throws org.apache.geode.admin.AdminException {
return new SystemMemberJmxImpl(this, member);
}
-
+
@Override
- protected CacheServer createCacheServer(ApplicationVM member)
- throws AdminException {
+ protected CacheServer createCacheServer(ApplicationVM member) throws AdminException {
return new CacheServerJmxImpl(this, member);
}
@Override
- protected CacheServer createCacheServer(CacheServerConfigImpl config)
- throws AdminException {
+ protected CacheServer createCacheServer(CacheServerConfigImpl config) throws AdminException {
return new CacheServerJmxImpl(this, config);
}
/** Override createGemFireHealth by instantiating GemFireHealthJmxImpl */
@Override
- protected GemFireHealth createGemFireHealth(GfManagerAgent system)
- throws org.apache.geode.admin.AdminException {
+ protected GemFireHealth createGemFireHealth(GfManagerAgent system)
+ throws org.apache.geode.admin.AdminException {
if (system == null) {
- throw new IllegalStateException(LocalizedStrings.AdminDistributedSystemJmxImpl_GFMANAGERAGENT_MUST_NOT_BE_NULL.toLocalizedString());
+ throw new IllegalStateException(
+ LocalizedStrings.AdminDistributedSystemJmxImpl_GFMANAGERAGENT_MUST_NOT_BE_NULL
+ .toLocalizedString());
}
return new GemFireHealthJmxImpl(system, this);
}
-
+
/** Template-method for creating a DistributionLocatorImpl instance. */
@Override
- protected DistributionLocatorImpl
- createDistributionLocatorImpl(DistributionLocatorConfig config) {
+ protected DistributionLocatorImpl createDistributionLocatorImpl(
+ DistributionLocatorConfig config) {
return new DistributionLocatorJmxImpl(config, this);
}
// -------------------------------------------------------------------------
- // Internal Admin listeners and JMX Notifications
+ // Internal Admin listeners and JMX Notifications
// -------------------------------------------------------------------------
-
+
/** Notification type for indicating system member joined */
public static final String NOTIF_MEMBER_JOINED =
DistributionConfig.GEMFIRE_PREFIX + "distributedsystem.member.joined";
@@ -310,61 +287,71 @@ public class AdminDistributedSystemJmxImpl
/** Notification type for indicating abnormal disconnection from the distributed system */
public static final String NOTIF_ADMIN_SYSTEM_DISCONNECT =
DistributionConfig.GEMFIRE_PREFIX + "distributedsystem.disconnect";
-
-
+
+
private static final String EML_SUBJ_PRFX_GFE_ALERT = "[GemFire Alert] ";
private static final String EML_SUBJ_PRFX_GFE_NOTFY = "[GemFire Notification] ";
private static final String EML_SUBJ_ITEM_GFE_DS = "Distributed System: ";
// --------- org.apache.geode.internal.admin.JoinLeaveListener ---------
- /**
+ /**
* Listener callback for when a member has joined this DistributedSystem.
* <p>
- * React by creating an MBean for managing the SystemMember and then fire
- * a Notification with the internal Id of the member VM.
+ * React by creating an MBean for managing the SystemMember and then fire a Notification with the
+ * internal Id of the member VM.
*
- * @param source the distributed system that fired nodeJoined
- * @param joined the VM that joined
+ * @param source the distributed system that fired nodeJoined
+ * @param joined the VM that joined
* @see org.apache.geode.internal.admin.JoinLeaveListener#nodeJoined
*/
@Override
public void nodeJoined(GfManagerAgent source, GemFireVM joined) {
try {
super.nodeJoined(source, joined);
-
- /* super.nodeJoined results in creation of a new SystemMember which
- * registers itself as an MBean, so now we try to find it...
+
+ /*
+ * super.nodeJoined results in creation of a new SystemMember which registers itself as an
+ * MBean, so now we try to find it...
*/
SystemMember member = findSystemMember(joined);
-
- if(null == member) {
+
+ if (null == member) {
if (logger.isDebugEnabled()) {
- logger.debug("AdminDistributedSystemJmxImpl.nodeJoined(), Could not find SystemMember for VM {}", joined);
+ logger.debug(
+ "AdminDistributedSystemJmxImpl.nodeJoined(), Could not find SystemMember for VM {}",
+ joined);
}
return;
}
-
+
try {
if (logger.isDebugEnabled()) {
logger.debug("Processing node joined for: {}", member);
logger.debug("RemoteGemFireVM.nodeJoined(), setting alerts manager *************");
}
setAlertsManager(joined);
-
- this.modelMBean.sendNotification(new Notification(
- NOTIF_MEMBER_JOINED,
- ((ManagedResource)member).getObjectName(), // Pass the ObjName of the Source Member
- notificationSequenceNumber.addAndGet(1),
- joined.getId().toString()));
-
-// String mess = "Gemfire AlertNotification: System Member Joined, System member Id: " + joined.getId().toString();
-// sendEmail("Gemfire AlertNotification: Member Joined, ID: " + joined.getId().toString(), mess);
+
+ this.modelMBean.sendNotification(
+ new Notification(NOTIF_MEMBER_JOINED, ((ManagedResource) member).getObjectName(), // Pass
+ // the
+ // ObjName
+ // of
+ // the
+ // Source
+ // Member
+ notificationSequenceNumber.addAndGet(1), joined.getId().toString()));
+
+ // String mess = "Gemfire AlertNotification: System Member Joined, System member Id: " +
+ // joined.getId().toString();
+ // sendEmail("Gemfire AlertNotification: Member Joined, ID: " + joined.getId().toString(),
+ // mess);
if (isEmailNotificationEnabled) {
- String mess = LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_JOINED_THE_DISTRIBUTED_SYSTEM_MEMBER_ID_0.toLocalizedString(new Object[] {joined.getId().toString()} );
- sendEmail(
- EML_SUBJ_PRFX_GFE_NOTFY + EML_SUBJ_ITEM_GFE_DS + getName() + " <"
- + LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_JOINED.toLocalizedString() +">",
- mess);
+ String mess =
+ LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_JOINED_THE_DISTRIBUTED_SYSTEM_MEMBER_ID_0
+ .toLocalizedString(new Object[] {joined.getId().toString()});
+ sendEmail(EML_SUBJ_PRFX_GFE_NOTFY + EML_SUBJ_ITEM_GFE_DS + getName() + " <"
+ + LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_JOINED.toLocalizedString()
+ + ">", mess);
}
} catch (javax.management.MBeanException e) {
logger.warn(e.getMessage(), e);
@@ -374,12 +361,12 @@ public class AdminDistributedSystemJmxImpl
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -388,15 +375,15 @@ public class AdminDistributedSystemJmxImpl
throw e;
}
}
-
- /**
+
+ /**
* Listener callback for when a member has left this DistributedSystem.
* <p>
- * React by removing the member's MBean.
- * Also fire a Notification with the internal Id of the member VM.
+ * React by removing the member's MBean. Also fire a Notification with the internal Id of the
+ * member VM.
*
- * @param source the distributed system that fired nodeLeft
- * @param left the VM that left
+ * @param source the distributed system that fired nodeLeft
+ * @param left the VM that left
* @see org.apache.geode.internal.admin.JoinLeaveListener#nodeLeft
*/
@Override
@@ -408,26 +395,33 @@ public class AdminDistributedSystemJmxImpl
logger.debug("Processing node left for: {}", member);
}
try {
- this.modelMBean.sendNotification(new Notification(
- NOTIF_MEMBER_LEFT,
- ((ManagedResource)member).getObjectName(), // Pass the ObjName of the Source Member
- notificationSequenceNumber.addAndGet(1),
- left.getId().toString()));
-
-// String mess = "Gemfire AlertNotification: System Member Left the system, System member Id: " + left.getId().toString();
-// sendEmail("Gemfire AlertNotification: Member Left, ID: " + left.getId().toString(), mess);
+ this.modelMBean.sendNotification(
+ new Notification(NOTIF_MEMBER_LEFT, ((ManagedResource) member).getObjectName(), // Pass
+ // the
+ // ObjName
+ // of
+ // the
+ // Source
+ // Member
+ notificationSequenceNumber.addAndGet(1), left.getId().toString()));
+
+ // String mess = "Gemfire AlertNotification: System Member Left the system, System member
+ // Id: " + left.getId().toString();
+ // sendEmail("Gemfire AlertNotification: Member Left, ID: " + left.getId().toString(),
+ // mess);
if (isEmailNotificationEnabled) {
- String mess = LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_LEFT_THE_DISTRIBUTED_SYSTEM_MEMBER_ID_0.toLocalizedString(new Object[] {left.getId().toString()} );
- sendEmail(
- EML_SUBJ_PRFX_GFE_NOTFY + EML_SUBJ_ITEM_GFE_DS + getName() + " <"
- + LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_LEFT.toLocalizedString() +">",
- mess);
+ String mess =
+ LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_LEFT_THE_DISTRIBUTED_SYSTEM_MEMBER_ID_0
+ .toLocalizedString(new Object[] {left.getId().toString()});
+ sendEmail(EML_SUBJ_PRFX_GFE_NOTFY + EML_SUBJ_ITEM_GFE_DS + getName() + " <"
+ + LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_LEFT.toLocalizedString()
+ + ">", mess);
}
- } catch (javax.management.MBeanException e) {
+ } catch (javax.management.MBeanException e) {
logger.warn(e.getMessage(), e);
}
-
- SystemMemberType memberType = member.getType();
+
+ SystemMemberType memberType = member.getType();
if (/* member != null && */ memberType.isApplication() || memberType.isCacheVm()) {
// automatically unregister the MBean...
MBeanUtil.unregisterMBean((ManagedResource) member);
@@ -437,12 +431,12 @@ public class AdminDistributedSystemJmxImpl
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -451,13 +445,13 @@ public class AdminDistributedSystemJmxImpl
throw e;
}
}
-
- /**
+
+ /**
* Listener callback for when a member of this DistributedSystem has crashed.
* <p>
* Also fires a Notification with the internal Id of the member VM.
*
- * @param source the distributed system that fired nodeCrashed
+ * @param source the distributed system that fired nodeCrashed
* @param crashed the VM that crashed
* @see org.apache.geode.internal.admin.JoinLeaveListener#nodeCrashed
*/
@@ -470,22 +464,29 @@ public class AdminDistributedSystemJmxImpl
if (logger.isDebugEnabled()) {
logger.debug("Processing node crash for: {}", member);
}
-
+
try {
- this.modelMBean.sendNotification(new Notification(
- NOTIF_MEMBER_CRASHED,
- ((ManagedResource)member).getObjectName(), // Pass the ObjName of the Source Member
- notificationSequenceNumber.addAndGet(1),
- crashed.getId().toString()));
-
-// String mess = "Gemfire AlertNotification: System Member Crashed, System member Id: " + crashed.getId().toString();
-// sendEmail("Gemfire AlertNotification: Member Crashed, ID: " + crashed.getId().toString(), mess);
+ this.modelMBean.sendNotification(
+ new Notification(NOTIF_MEMBER_CRASHED, ((ManagedResource) member).getObjectName(), // Pass
+ // the
+ // ObjName
+ // of
+ // the
+ // Source
+ // Member
+ notificationSequenceNumber.addAndGet(1), crashed.getId().toString()));
+
+ // String mess = "Gemfire AlertNotification: System Member Crashed, System member Id: " +
+ // crashed.getId().toString();
+ // sendEmail("Gemfire AlertNotification: Member Crashed, ID: " + crashed.getId().toString(),
+ // mess);
if (isEmailNotificationEnabled) {
- String mess = LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_CRASHED_IN_THE_DISTRIBUTED_SYSTEM_MEMBER_ID_0.toLocalizedString(new Object[] {crashed.getId().toString()} );
- sendEmail(
- EML_SUBJ_PRFX_GFE_ALERT + EML_SUBJ_ITEM_GFE_DS + getName() + " <"
- + LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_CRASHED.toLocalizedString() +">",
- mess);
+ String mess =
+ LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_CRASHED_IN_THE_DISTRIBUTED_SYSTEM_MEMBER_ID_0
+ .toLocalizedString(new Object[] {crashed.getId().toString()});
+ sendEmail(EML_SUBJ_PRFX_GFE_ALERT + EML_SUBJ_ITEM_GFE_DS + getName() + " <"
+ + LocalizedStrings.AdminDistributedSystemJmxImpl_MEMBER_CRASHED.toLocalizedString()
+ + ">", mess);
}
} catch (javax.management.MBeanException e) {
logger.warn(e.getMessage(), e);
@@ -501,12 +502,12 @@ public class AdminDistributedSystemJmxImpl
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -517,9 +518,8 @@ public class AdminDistributedSystemJmxImpl
}
// ----------- org.apache.geode.internal.admin.AlertListener -----------
- /**
- * Listener callback for when a SystemMember of this DistributedSystem has
- * crashed.
+ /**
+ * Listener callback for when a SystemMember of this DistributedSystem has crashed.
* <p>
* Fires a Notification with the information from the alert.
*
@@ -532,17 +532,17 @@ public class AdminDistributedSystemJmxImpl
super.alert(alert);
try {
String strAlert = alert.toString();
- this.modelMBean.sendNotification(new Notification(
- NOTIF_ALERT,
- this.mbeanName,
- notificationSequenceNumber.addAndGet(1),
- strAlert));
-
-// String mess = "Gemfire AlertNotification: System Alert :" + alert.toString();
-// sendEmail("Gemfire AlertNotification: System Alert", mess);
+ this.modelMBean.sendNotification(new Notification(NOTIF_ALERT, this.mbeanName,
+ notificationSequenceNumber.addAndGet(1), strAlert));
+
+ // String mess = "Gemfire AlertNotification: System Alert :" + alert.toString();
+ // sendEmail("Gemfire AlertNotification: System Alert", mess);
if (isEmailNotificationEnabled) {
- String mess = LocalizedStrings.AdminDistributedSystemJmxImpl_SYSTEM_ALERT_FROM_DISTRIBUTED_SYSTEM_0.toLocalizedString(strAlert);
- sendEmail( EML_SUBJ_PRFX_GFE_ALERT + EML_SUBJ_ITEM_GFE_DS + getName() + " <System Alert>", mess);
+ String mess =
+ LocalizedStrings.AdminDistributedSystemJmxImpl_SYSTEM_ALERT_FROM_DISTRIBUTED_SYSTEM_0
+ .toLocalizedString(strAlert);
+ sendEmail(EML_SUBJ_PRFX_GFE_ALERT + EML_SUBJ_ITEM_GFE_DS + getName() + " <System Alert>",
+ mess);
}
} catch (javax.management.MBeanException e) {
logger.warn(e.getMessage(), e);
@@ -552,12 +552,12 @@ public class AdminDistributedSystemJmxImpl
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -566,70 +566,68 @@ public class AdminDistributedSystemJmxImpl
throw e;
}
}
-
+
@Override
public void onDisconnect(InternalDistributedSystem sys) {
if (logger.isDebugEnabled()) {
this.logger.debug("Calling AdminDistributedSystemJmxImpl#onDisconnect");
}
- try {
- super.onDisconnect(sys);
-
- try {
- this.modelMBean.sendNotification(new Notification(
- NOTIF_ADMIN_SYSTEM_DISCONNECT,
- this.mbeanName,
- notificationSequenceNumber.addAndGet(1),
- null));
- } catch (MBeanException e) {
- logger.warn(e.getMessage(), e);
- }
- } catch (RuntimeException e) {
- logger.warn(e.getMessage(), e);
- throw e;
- } catch (VirtualMachineError err) {
- SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
- // now, so don't let this thread continue.
- throw err;
- } catch (Error e) {
- // Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
- // _still_ a possibility that you are dealing with a cascading
- // error condition, so you also need to check to see if the JVM
- // is still usable:
- SystemFailure.checkFailure();
- logger.error(e.getMessage(), e);
- throw e;
- }
- if (logger.isDebugEnabled()) {
- this.logger.debug("Completed AdminDistributedSystemJmxImpl#onDisconnect");
- }
- }
-
+ try {
+ super.onDisconnect(sys);
+
+ try {
+ this.modelMBean.sendNotification(new Notification(NOTIF_ADMIN_SYSTEM_DISCONNECT,
+ this.mbeanName, notificationSequenceNumber.addAndGet(1), null));
+ } catch (MBeanException e) {
+ logger.warn(e.getMessage(), e);
+ }
+ } catch (RuntimeException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
+ } catch (VirtualMachineError err) {
+ SystemFailure.initiateFailure(err);
+ // If this ever returns, rethrow the error. We're poisoned
+ // now, so don't let this thread continue.
+ throw err;
+ } catch (Error e) {
+ // Whenever you catch Error or Throwable, you must also
+ // catch VirtualMachineError (see above). However, there is
+ // _still_ a possibility that you are dealing with a cascading
+ // error condition, so you also need to check to see if the JVM
+ // is still usable:
+ SystemFailure.checkFailure();
+ logger.error(e.getMessage(), e);
+ throw e;
+ }
+ if (logger.isDebugEnabled()) {
+ this.logger.debug("Completed AdminDistributedSystemJmxImpl#onDisconnect");
+ }
+ }
+
// -------------------------------------------------------------------------
- // ManagedResource implementation
+ // ManagedResource implementation
// -------------------------------------------------------------------------
-
+
/** The name of the MBean that will manage this resource */
private String mbeanName;
- /** The remotable ObjectName that the MBean is registered under */
+ /** The remotable ObjectName that the MBean is registered under */
final private ObjectName objectName;
-
+
/** The ModelMBean that is configured to manage this resource */
private ModelMBean modelMBean;
-
- public String getMBeanName() {
- return this.mbeanName;
- }
-
- public ModelMBean getModelMBean() {
- return this.modelMBean;
- }
- public void setModelMBean(ModelMBean modelMBean) {
- this.modelMBean = modelMBean;
- }
+
+ public String getMBeanName() {
+ return this.mbeanName;
+ }
+
+ public ModelMBean getModelMBean() {
+ return this.modelMBean;
+ }
+
+ public void setModelMBean(ModelMBean modelMBean) {
+ this.modelMBean = modelMBean;
+ }
public ObjectName getObjectName() {
return this.objectName;
@@ -638,11 +636,11 @@ public class AdminDistributedSystemJmxImpl
public ManagedResourceType getManagedResourceType() {
return ManagedResourceType.DISTRIBUTED_SYSTEM;
}
-
+
// -------------------------------------------------------------------------
- // Error traps added to overridden methods...
+ // Error traps added to overridden methods...
// -------------------------------------------------------------------------
-
+
@Override
public boolean isRunning() {
try {
@@ -652,12 +650,12 @@ public class AdminDistributedSystemJmxImpl
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (java.lang.Error e) {
+ } catch (java.lang.Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -676,12 +674,12 @@ public class AdminDistributedSystemJmxImpl
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (java.lang.Error e) {
+ } catch (java.lang.Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -690,7 +688,7 @@ public class AdminDistributedSystemJmxImpl
throw e;
}
}
-
+
@Override
public void stop() throws AdminException {
try {
@@ -700,12 +698,12 @@ public class AdminDistributedSystemJmxImpl
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (java.lang.Error e) {
+ } catch (java.lang.Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -716,10 +714,10 @@ public class AdminDistributedSystemJmxImpl
}
@Override
- public boolean waitToBeConnected(long timeout)
- throws InterruptedException {
+ public boolean waitToBeConnected(long timeout) throws InterruptedException {
- if (Thread.interrupted()) throw new InterruptedException();
+ if (Thread.interrupted())
+ throw new InterruptedException();
try {
return super.waitToBeConnected(timeout);
} catch (java.lang.RuntimeException e) {
@@ -727,12 +725,12 @@ public class AdminDistributedSystemJmxImpl
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (java.lang.Error e) {
+ } catch (java.lang.Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -751,12 +749,12 @@ public class AdminDistributedSystemJmxImpl
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (java.lang.Error e) {
+ } catch (java.lang.Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -766,24 +764,23 @@ public class AdminDistributedSystemJmxImpl
}
}
- public ObjectName manageDistributionLocator()
- throws MalformedObjectNameException {
+ public ObjectName manageDistributionLocator() throws MalformedObjectNameException {
try {
return new ObjectName(((ManagedResource) addDistributionLocator()).getMBeanName());
}
-// catch (AdminException e) { logger.warn(e.getMessage(), e); throw e; }
+ // catch (AdminException e) { logger.warn(e.getMessage(), e); throw e; }
catch (RuntimeException e) {
logger.warn(e.getMessage(), e);
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -793,8 +790,7 @@ public class AdminDistributedSystemJmxImpl
}
}
- public ObjectName[] manageDistributionLocators()
- throws MalformedObjectNameException {
+ public ObjectName[] manageDistributionLocators() throws MalformedObjectNameException {
try {
DistributionLocator[] locs = getDistributionLocators();
ObjectName[] onames = new javax.management.ObjectName[locs.length];
@@ -804,59 +800,58 @@ public class AdminDistributedSystemJmxImpl
}
return onames;
}
- //catch (AdminException e) { logger.warn(e.getMessage(), e); throw e; }
- catch (RuntimeException e) {
- logger.warn(e.getMessage(), e);
- throw e;
+ // catch (AdminException e) { logger.warn(e.getMessage(), e); throw e; }
+ catch (RuntimeException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
- logger.error(e.getMessage(), e);
- throw e;
+ logger.error(e.getMessage(), e);
+ throw e;
}
}
-
+
/**
* @deprecated as of 5.7 use {@link #manageCacheVm} instead.
*/
@Deprecated
- public ObjectName manageCacheServer()
- throws AdminException, MalformedObjectNameException {
+ public ObjectName manageCacheServer() throws AdminException, MalformedObjectNameException {
return manageCacheVm();
}
- public ObjectName manageCacheVm()
- throws AdminException, MalformedObjectNameException {
+
+ public ObjectName manageCacheVm() throws AdminException, MalformedObjectNameException {
try {
return new ObjectName(((ManagedResource) addCacheVm()).getMBeanName());
- } catch (AdminException e) {
- logger.warn(e.getMessage(), e);
- throw e;
- } catch (RuntimeException e) {
- logger.warn(e.getMessage(), e);
- throw e;
+ } catch (AdminException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
+ } catch (RuntimeException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
logger.warn(e.getMessage(), e);
- throw e;
+ throw e;
}
}
@@ -864,13 +859,11 @@ public class AdminDistributedSystemJmxImpl
* @deprecated as of 5.7 use {@link #manageCacheVms} instead.
*/
@Deprecated
- public ObjectName[] manageCacheServers()
- throws AdminException, MalformedObjectNameException {
+ public ObjectName[] manageCacheServers() throws AdminException, MalformedObjectNameException {
return manageCacheVms();
}
- public ObjectName[] manageCacheVms()
- throws AdminException, MalformedObjectNameException {
+ public ObjectName[] manageCacheVms() throws AdminException, MalformedObjectNameException {
try {
CacheVm[] mgrs = getCacheVms();
ObjectName[] onames = new javax.management.ObjectName[mgrs.length];
@@ -879,31 +872,31 @@ public class AdminDistributedSystemJmxImpl
onames[i] = new ObjectName(mgr.getMBeanName());
}
return onames;
- } catch (AdminException e) {
- logger.warn(e.getMessage(), e);
- throw e;
- } catch (RuntimeException e) {
- logger.warn(e.getMessage(), e);
- throw e;
+ } catch (AdminException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
+ } catch (RuntimeException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
logger.error(e.getMessage(), e);
- throw e;
+ throw e;
}
}
public ObjectName[] manageSystemMemberApplications()
- throws AdminException, MalformedObjectNameException {
+ throws AdminException, MalformedObjectNameException {
try {
SystemMember[] apps = getSystemMemberApplications();
ObjectName[] onames = new javax.management.ObjectName[apps.length];
@@ -912,73 +905,74 @@ public class AdminDistributedSystemJmxImpl
onames[i] = new ObjectName(app.getMBeanName());
}
return onames;
- } catch (AdminException e) {
- logger.warn(e.getMessage(), e);
- throw e;
- } catch (RuntimeException e) {
- logger.warn(e.getMessage(), e);
- throw e;
+ } catch (AdminException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
+ } catch (RuntimeException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
logger.error(e.getMessage(), e);
- throw e;
+ throw e;
}
}
-
+
/**
- * Return the ObjectName for the SystemMemberMBean representing the
- * specified distributed member or null if the member is not found.
+ * Return the ObjectName for the SystemMemberMBean representing the specified distributed member
+ * or null if the member is not found.
*
* @param distributedMember the distributed member to manage
* @return the ObjectName for the SystemMemberMBean
*/
public ObjectName manageSystemMember(DistributedMember distributedMember)
- throws AdminException, MalformedObjectNameException {
+ throws AdminException, MalformedObjectNameException {
try {
SystemMember member = lookupSystemMember(distributedMember);
- if (member == null) return null;
+ if (member == null)
+ return null;
SystemMemberJmxImpl jmx = (SystemMemberJmxImpl) member;
ObjectName oname = new ObjectName(jmx.getMBeanName());
return oname;
- } catch (AdminException e) {
- logger.warn(e.getMessage(), e);
- throw e;
- } catch (RuntimeException e) {
- logger.warn(e.getMessage(), e);
- throw e;
+ } catch (AdminException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
+ } catch (RuntimeException e) {
+ logger.warn(e.getMessage(), e);
+ throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
logger.error(e.getMessage(), e);
- throw e;
+ throw e;
}
}
-
+
@Override
public void connect(InternalLogWriter logWriter) {
try {
// LOG: passes the AdminDistributedSystemImpl LogWriterLogger into GfManagerAgentConfig
super.connect(logWriter);
-
+
// Load existing StatAlert Definitions
readAlertDefinitionsAsSerializedObjects();
@@ -987,31 +981,31 @@ public class AdminDistributedSystemJmxImpl
logger.debug("Adding CacheAndRegionListener .... ");
}
addCacheListener(cacheRegionListener);
- } catch (RuntimeException e) {
+ } catch (RuntimeException e) {
logger.warn(e.getMessage(), e);
- throw e;
+ throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, rethrow the error. We're poisoned
+ // If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
logger.error(e.getMessage(), e);
- throw e;
+ throw e;
}
}
-
+
@Override
public void disconnect() {
try {
super.disconnect();
-
+
// Save existing StatAlert Definitions
saveAlertDefinitionsAsSerializedObjects();
@@ -1019,18 +1013,18 @@ public class AdminDistributedSystemJmxImpl
if (logger.isDebugEnabled()) {
logger.debug("Removing CacheAndRegionListener .... ");
}
- removeCacheListener(cacheRegionListener);
- } catch (RuntimeException e) {
+ removeCacheListener(cacheRegionListener);
+ } catch (RuntimeException e) {
logger.warn(e.getMessage(), e);
throw e;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
- // If this ever returns, re-throw the error. We're poisoned
+ // If this ever returns, re-throw the error. We're poisoned
// now, so don't let this thread continue.
throw err;
- } catch (Error e) {
+ } catch (Error e) {
// Whenever you catch Error or Throwable, you must also
- // catch VirtualMachineError (see above). However, there is
+ // catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
@@ -1043,7 +1037,7 @@ public class AdminDistributedSystemJmxImpl
public void cleanupResource() {
disconnect();
}
-
+
/**
* @return the isRmiClientCountZero
* @since GemFire 6.0
@@ -1058,14 +1052,15 @@ public class AdminDistributedSystemJmxImpl
*/
void setRmiClientCountZero(boolean isRmiClientCountZero) {
this.isRmiClientCountZero = isRmiClientCountZero;
-
+
if (isRmiClientCountZero) {
- logger.info(LocalizedStrings.AdminDistributedSystemJmxImpl_JMX_CLIENT_COUNT_HAS_DROPPED_TO_ZERO);
+ logger.info(
+ LocalizedStrings.AdminDistributedSystemJmxImpl_JMX_CLIENT_COUNT_HAS_DROPPED_TO_ZERO);
}
}
- /////////////////////// Configuration ///////////////////////
+ /////////////////////// Configuration ///////////////////////
public String getEntityConfigXMLFile() {
return this.getConfig().getEntityConfigXMLFile();
@@ -1091,7 +1086,7 @@ public class AdminDistributedSystemJmxImpl
public void setSystemName(final String name) {
this.getConfig().setSystemName(name);
}
-
+
@Override
public boolean getDisableTcp() {
return this.getConfig().getDisableTcp();
@@ -1100,16 +1095,19 @@ public class AdminDistributedSystemJmxImpl
public void setEnableNetworkPartitionDetection(boolean newValue) {
getConfig().setEnableNetworkPartitionDetection(newValue);
}
+
public boolean getEnableNetworkPartitionDetection() {
return getConfig().getEnableNetworkPartitionDetection();
}
+
public int getMemberTimeout() {
- return getConfig().getMemberTimeout();
+ return getConfig().getMemberTimeout();
}
+
public void setMemberTimeout(int value) {
getConfig().setMemberTimeout(value);
}
-
+
@Override
public String getMcastAddress() {
return this.getConfig().getMcastAddress();
@@ -1123,7 +1121,7 @@ public class AdminDistributedSystemJmxImpl
public int getMcastPort() {
return this.getConfig().getMcastPort();
}
-
+
public void setMcastPort(int mcastPort) {
this.getConfig().setMcastPort(mcastPort);
}
@@ -1131,7 +1129,7 @@ public class AdminDistributedSystemJmxImpl
public int getAckWaitThreshold() {
return getConfig().getAckWaitThreshold();
}
-
+
public void setAckWaitThreshold(int seconds) {
getConfig().setAckWaitThreshold(seconds);
}
@@ -1139,7 +1137,7 @@ public class AdminDistributedSystemJmxImpl
public int getAckSevereAlertThreshold() {
return getConfig().getAckSevereAlertThreshold();
}
-
+
public void setAckSevereAlertThreshold(int seconds) {
getConfig().setAckSevereAlertThreshold(seconds);
}
@@ -1153,9 +1151,11 @@ public class AdminDistributedSystemJmxImpl
public void setLocators(String locators) {
this.getConfig().setLocators(locators);
}
-
- /* Note that the getter & setter for membership port range are referred from
- * the super class AdminDistributedSystemImpl */
+
+ /*
+ * Note that the getter & setter for membership port range are referred from the super class
+ * AdminDistributedSystemImpl
+ */
public String getBindAddress() {
return this.getConfig().getBindAddress();
@@ -1164,7 +1164,7 @@ public class AdminDistributedSystemJmxImpl
public void setBindAddress(String bindAddress) {
this.getConfig().setBindAddress(bindAddress);
}
-
+
public String getServerBindAddress() {
return this.getConfig().getServerBindAddress();
}
@@ -1214,7 +1214,7 @@ public class AdminDistributedSystemJmxImpl
public void setSSLAuthenticationRequired(boolean authRequired) {
this.getConfig().setSSLAuthenticationRequired(authRequired);
}
-
+
public Properties getSSLProperties() {
return this.getConfig().getSSLProperties();
}
@@ -1230,7 +1230,7 @@ public class AdminDistributedSystemJmxImpl
public void removeSSLProperty(String key) {
this.getConfig().removeSSLProperty(key);
}
-
+
public String getLogFile() {
return this.getConfig().getLogFile();
}
@@ -1272,12 +1272,10 @@ public class AdminDistributedSystemJmxImpl
}
/*
- * The interval (in seconds) between auto-polling for updating
- * AdminDistributedSystem constituents including SystemMember,
- * SystemMemberCache and StatisticResource. This applies only to the default
- * interval set when the resource is created. Changes to this interval will
- * not get propagated to existing resources but will apply to all new
- * resources
+ * The interval (in seconds) between auto-polling for updating AdminDistributedSystem constituents
+ * including SystemMember, SystemMemberCache and StatisticResource. This applies only to the
+ * default interval set when the resource is created. Changes to this interval will not get
+ * propagated to existing resources but will apply to all new resources
*/
public void setRefreshInterval(int interval) {
this.getConfig().setRefreshInterval(interval);
@@ -1310,13 +1308,12 @@ public class AdminDistributedSystemJmxImpl
public DistributionLocatorConfig[] getDistributionLocatorConfigs() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
-
+
public DistributionLocatorConfig createDistributionLocatorConfig() {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
- public void removeDistributionLocatorConfig(DistributionLocatorConfig config)
-{
+ public void removeDistributionLocatorConfig(DistributionLocatorConfig config) {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
@@ -1336,45 +1333,52 @@ public class AdminDistributedSystemJmxImpl
public Object clone() throws CloneNotSupportedException {
throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
}
-
+
private static final String[] PERSISTENT_ID_FIELDS = new String[] {"host", "directory", "uuid"};
- private static final String[] PERSISTENT_ID_DESCRIPTIONS = new String[] {"The host that was persisting the missing files", "The directory where the files were persisted", "The unique id for the persistent files"};
+ private static final String[] PERSISTENT_ID_DESCRIPTIONS =
+ new String[] {"The host that was persisting the missing files",
+ "The directory where the files were persisted", "The unique id for the persistent files"};
private final CompositeType PERSISTENT_ID_TYPE;
private final TabularType PERSISTENT_ID_TABLE_TYPE;
-
- {
+
+ {
try {
- PERSISTENT_ID_TYPE = new CompositeType(PersistentID.class.getCanonicalName(), "A single member's a set of persistent files for a region", PERSISTENT_ID_FIELDS, PERSISTENT_ID_DESCRIPTIONS, new OpenType[] {SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
- PERSISTENT_ID_TABLE_TYPE = new TabularType("TABLE_" + PERSISTENT_ID_TYPE.getTypeName(), "A table of persistent member ids", PERSISTENT_ID_TYPE, PERSISTENT_ID_FIELDS);
+ PERSISTENT_ID_TYPE = new CompositeType(PersistentID.class.getCanonicalName(),
+ "A single member's a set of persistent files for a region", PERSISTENT_ID_FIELDS,
+ PERSISTENT_ID_DESCRIPTIONS,
+ new OpenType[] {SimpleType.STRING, SimpleType.STRING, SimpleType.STRING});
+ PERSISTENT_ID_TABLE_TYPE = new TabularType("TABLE_" + PERSISTENT_ID_TYPE.getTypeName(),
+ "A table of persistent member ids", PERSISTENT_ID_TYPE, PERSISTENT_ID_FIELDS);
} catch (OpenDataException e) {
throw new ExceptionInInitializerError(e);
}
}
-
+
public TabularData getMissingPersistentMembersJMX() throws AdminException {
-
+
try {
Set<PersistentID> members = super.getMissingPersistentMembers();
TabularData results = new TabularDataSupport(PERSISTENT_ID_TABLE_TYPE);
int index = 0;
- for(PersistentID id : members) {
- CompositeData idData = new CompositeDataSupport(PERSISTENT_ID_TYPE, PERSISTENT_ID_FIELDS, new Object[] {id.getHost().toString(), id.getDirectory(), id.getUUID().toString()});
+ for (PersistentID id : members) {
+ CompositeData idData = new CompositeDataSupport(PERSISTENT_ID_TYPE, PERSISTENT_ID_FIELDS,
+ new Object[] {id.getHost().toString(), id.getDirectory(), id.getUUID().toString()});
results.put(idData);
index++;
}
return results;
- } catch( OpenDataException e) {
+ } catch (OpenDataException e) {
logger.warn("Exception occurred while getting missing persistent members.", e);
throw new AdminException(e);
}
}
- public void revokePersistentMember(String host,
- String directory) throws AdminException, UnknownHostException {
+ public void revokePersistentMember(String host, String directory)
+ throws AdminException, UnknownHostException {
super.revokePersistentMember(InetAddress.getByName(host), directory);
}
-
+
public void revokePersistentMember(String uuid) throws AdminException, UnknownHostException {
super.revokePersistentMember(UUID.fromString(uuid));
}
@@ -1382,55 +1386,55 @@ public class AdminDistributedSystemJmxImpl
/* ********************************************************************* */
/* ************** Implementing StatAlertsAggregator interface ********** */
/* ********************************************************************* */
-
+
/* Map to store admin stat alert definitions */
private final Map ALERT_DEFINITIONS = new Hashtable();
-
+
/* Refresh interval for all stat alerts managers in seconds */
private int refreshIntervalForStatAlerts = 20;
- /*
- * This map contains list of stat alerts as a value for alert def ID as a key
+ /*
+ * This map contains list of stat alerts as a value for alert def ID as a key
*/
private final HashMap alertsStore = new HashMap();
-
- //TODO: yet to set the timer task
-// private SystemTimer systemwideAlertNotificationScheduler = new SystemTimer();
-
+
+ // TODO: yet to set the timer task
+ // private SystemTimer systemwideAlertNotificationScheduler = new SystemTimer();
+
private MailManager mailManager = null;
private final boolean isEmailNotificationEnabled;
-
+
/**
* Convenience method to retrieve admin stat alert definition.
*
- * @param alertDefinitionId id of a stat alert definition
+ * @param alertDefinitionId id of a stat alert definition
* @return StatAlertDefinition reference to an instance of StatAlertDefinition
* @since GemFire 5.7
*/
private StatAlertDefinition getAlertDefinition(int alertDefinitionId) {
- synchronized(ALERT_DEFINITIONS) {
- return (StatAlertDefinition)ALERT_DEFINITIONS.get(Integer.valueOf(alertDefinitionId));
+ synchronized (ALERT_DEFINITIONS) {
+ return (StatAlertDefinition) ALERT_DEFINITIONS.get(Integer.valueOf(alertDefinitionId));
}
}
-
-/* private void setAlertDefinition(StatAlertDefinition alertDefinition) {
- ALERT_DEFINITIONS.put(Integer.valueOf(alertDefinition.getId()), alertDefinition);
- }*/
- /**
- * This method can be used to get an alert definition.
+ /*
+ * private void setAlertDefinition(StatAlertDefinition alertDefinition) {
+ * ALERT_DEFINITIONS.put(Integer.valueOf(alertDefinition.getId()), alertDefinition); }
+ */
+
+ /**
+ * This method can be used to get an alert definition.
*
* @param alertDefinition StatAlertDefinition to retrieve
- * @return StatAlertDefinition
+ * @return StatAlertDefinition
* @since GemFire 5.7
*/
public StatAlertDefinition getAlertDefinition(StatAlertDefinition alertDefinition) {
return getAlertDefinition(alertDefinition.getId());
}
-
+
/**
- * This method is used to write existing StatAlertDefinitions
- * to a file
+ * This method is used to write existing StatAlertDefinitions to a file
*/
protected void readAlertDefinitionsAsSerializedObjects() {
StatAlertDefinition[] defns = new StatAlertDefinition[0];
@@ -1441,21 +1445,23 @@ public class AdminDistributedSystemJmxImpl
try {
serFile = new File(statAlertDefnSerFile);
-
+
if (!canWriteToFile(serFile)) {/* can not write a file */
canPersistStatAlertDefs = false;
}
if (!serFile.exists()) {/* file does not exist */
return;
}
-
+
if (logger.isDebugEnabled()) {
- logger.debug("AdminDistributedSystemJmxImpl.readAlertDefinitionsAsSerializedObjects: File: {}", serFile.getPath());
+ logger.debug(
+ "AdminDistributedSystemJmxImpl.readAlertDefinitionsAsSerializedObjects: File: {}",
+ serFile.getPath());
}
foStr = new FileInputStream(serFile);
ooStr = new DataInputStream(foStr);
- defns = (StatAlertDefinition[])DataSerializer.readObjectArray(ooStr);
+ defns = (StatAlertDefinition[]) DataSerializer.readObjectArray(ooStr);
} catch (ClassNotFoundException cnfEx) {
logger.error(LocalizedMessage.create(
LocalizedStrings.AdminDistributedSystem_ENCOUNTERED_A_0_WHILE_LOADING_STATALERTDEFINITIONS_1,
@@ -1467,14 +1473,14 @@ public class AdminDistributedSystemJmxImpl
new Object[] {ex.getClass().getName(), statAlertDefnSerFile}), ex);
canPersistStatAlertDefs = false;
} finally {
- if (foStr!=null) {
+ if (foStr != null) {
try {
foStr.close();
} catch (IOException ex) {
;
}
}
- if (ooStr!=null) {
+ if (ooStr != null) {
try {
ooStr.close();
} catch (IOException ex) {
@@ -1482,15 +1488,14 @@ public class AdminDistributedSystemJmxImpl
}
}
}
-
- for (int i=0; i<defns.length; i++) {
+
+ for (int i = 0; i < defns.length; i++) {
updateAlertDefinition(defns[i]);
}
}
/**
- * This method is used to write existing StatAlertDefinitions
- * to a file
+ * This method is used to write existing StatAlertDefinitions to a file
*/
public void saveAlertDefinitionsAsSerializedObjects() {
File serFile = null;
@@ -1498,32 +1503,34 @@ public class AdminDistributedSystemJmxImpl
DataOutputStream ooStr = null;
try {
serFile = new File(statAlertDefnSerFile);
-
-
+
+
if (logger.isDebugEnabled()) {
- logger.debug("AdminDistributedSystemJmxImpl.saveAlertDefinitionsAsSerializedObjects: File: {}", serFile.getPath());
+ logger.debug(
+ "AdminDistributedSystemJmxImpl.saveAlertDefinitionsAsSerializedObjects: File: {}",
+ serFile.getPath());
}
-
+
if (!canWriteToFile(serFile)) {
return;
}
-
+
foStr = new FileOutputStream(serFile);
ooStr = new DataOutputStream(foStr);
-
+
int numOfAlerts = 0;
StatAlertDefinition[] defs = null;
synchronized (ALERT_DEFINITIONS) {
numOfAlerts = ALERT_DEFINITIONS.size();
defs = new StatAlertDefinition[numOfAlerts];
-
+
int i = 0;
- for (Iterator iter=ALERT_DEFINITIONS.keySet().iterator(); iter.hasNext() ;) {
+ for (Iterator iter = ALERT_DEFINITIONS.keySet().iterator(); iter.hasNext();) {
Integer key = (Integer) iter.next();
StatAlertDefinition readDefn = (StatAlertDefinition) ALERT_DEFINITIONS.get(key);
defs[i] = readDefn;
- i++;
+ i++;
}
}
@@ -1533,13 +1540,13 @@ public class AdminDistributedSystemJmxImpl
LocalizedStrings.AdminDistributedSystem_ENCOUNTERED_A_0_WHILE_SAVING_STATALERTDEFINITIONS_1,
new Object[] {ex.getClass().getName(), statAlertDefnSerFile}), ex);
} finally {
- if (foStr!=null)
+ if (foStr != null)
try {
foStr.close();
} catch (IOException ex) {
;
}
- if (ooStr!=null)
+ if (ooStr != null)
try {
ooStr.close();
} catch (IOException ex) {
@@ -1551,24 +1558,23 @@ public class AdminDistributedSystemJmxImpl
/**
* Checks if the given file is writable.
*
- * @param file
- * file to check write permissions for
+ * @param file file to check write permissions for
* @return true if file is writable, false otherwise
*/
private boolean canWriteToFile(File file) {
boolean fileIsWritable = true;
// Fix for BUG40360 : When the user does not have write permissions for
- // saving the stat-alert definitions, then appropriate warning message is
- // logged and the operation is aborted. In case the file doesn't exist, then
- // it attempts to create a file. If the attempt fails then it logs
+ // saving the stat-alert definitions, then appropriate warning message is
+ // logged and the operation is aborted. In case the file doesn't exist, then
+ // it attempts to create a file. If the attempt fails then it logs
// appropriate warning and the operation is aborted. File.canWrite check for
- // a directory sometimes fails on Windows platform. Hence file creation is
+ // a directory sometimes fails on Windows platform. Hence file creation is
// necessary.
if (file.exists()) {
if (!file.canWrite()) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.AdminDistributedSystemJmxImpl_READONLY_STAT_ALERT_DEF_FILE_0,
- new Object[] { file }));
+ new Object[] {file}));
fileIsWritable = false;
}
} else {
@@ -1577,102 +1583,101 @@ public class AdminDistributedSystemJmxImpl
} catch (IOException e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.AdminDistributedSystemJmxImpl_FAILED_TO_CREATE_STAT_ALERT_DEF_FILE_0,
- new Object[] { file }), e);
+ new Object[] {file}), e);
fileIsWritable = false;
} finally {
// Since we had created this file only for testing purpose, delete the
// same.
if ((file.exists() && !file.delete()) && logger.isDebugEnabled()) {
- logger.debug("Could not delete file :'{}' which is created for checking permissions.", file.getAbsolutePath());
+ logger.debug("Could not delete file :'{}' which is created for checking permissions.",
+ file.getAbsolutePath());
}
}
}
return fileIsWritable;
}
- /**
- * This method can be used to update alert definition for the Stat mentioned.
- * This method should update the collection maintained at the aggregator and
- * should notify members for the newly added alert definitions.
- * A new alert definition will be created if matching one not found.
+ /**
+ * This method can be used to update alert definition for the Stat mentioned. This method should
+ * update the collection maintained at the aggregator and should notify members for the newly
+ * added alert definitions. A new alert definition will be created if matching one not found.
*
- * @param alertDefinition alertDefinition to be updated
+ * @param alertDefinition alertDefinition to be updated
* @since GemFire 5.7
- */
+ */
public void updateAlertDefinition(StatAlertDefinition alertDefinition) {
if (logger.isDebugEnabled()) {
- logger.debug("Entered AdminDistributedSystemJmxImpl.updateAlertDefinition(StatAlertDefinition) *****");
+ logger.debug(
+ "Entered AdminDistributedSystemJmxImpl.updateAlertDefinition(StatAlertDefinition) *****");
}
/*
- * What to update in the alert definition? There should be another argument
- * or arguments in a map.
- * 1. Need to update the list/map of alert definitions across members.
+ * What to update in the alert definition? There should be another argument or arguments in a
+ * map. 1. Need to update the list/map of alert definitions across members.
*/
synchronized (ALERT_DEFINITIONS) {
ALERT_DEFINITIONS.put(Integer.valueOf(alertDefinition.getId()), alertDefinition);
-
+
if (logger.isDebugEnabled()) {
- logger.debug("AdminDistributedSystemJmxImpl.updateAlertDefinition : alertDefinition :: id={} :: {}", alertDefinition.getId(), alertDefinition.getStringRepresentation());
+ logger.debug(
+ "AdminDistributedSystemJmxImpl.updateAlertDefinition : alertDefinition :: id={} :: {}",
+ alertDefinition.getId(), alertDefinition.getStringRepresentation());
}
-
+
/* TODO: add code to retry on failure */
notifyMembersForAlertDefinitionChange(alertDefinition);
}
if (logger.isDebugEnabled()) {
- logger.debug("Exiting AdminDistributedSystemJmxImpl.updateAlertDefinition(StatAlertDefinition) *****");
+ logger.debug(
+ "Exiting AdminDistributedSystemJmxImpl.updateAlertDefinition(StatAlertDefinition) *****");
}
}
- /**
- * This method can be used to remove alert definition for the Stat
- * mentioned.
- * This method should update the collection maintained at the aggregator and
- * should notify members for the newly added alert definitions.
+ /**
+ * This method can be used to remove alert definition for the Stat mentioned. This method should
+ * update the collection maintained at the aggregator and should notify members for the newly
+ * added alert definitions.
*
* @param defId id of the alert definition to be removed
* @since GemFire 5.7
- */
+ */
public void removeAlertDefinition(Integer defId) {
if (logger.isDebugEnabled()) {
logger.debug("Entered AdminDistributedSystemJmxImpl.removeAlertDefinition id *****");
}
/*
- * alert passed to be deleted from the list/map of alerts on JMX MBean
- * & all Member MBeans
+ * alert passed to be deleted from the list/map of alerts on JMX MBean & all Member MBeans
*/
synchronized (ALERT_DEFINITIONS) {
- StatAlertDefinition alertDefinition = (StatAlertDefinition)ALERT_DEFINITIONS.get(defId);
- if (alertDefinition != null) {
- ALERT_DEFINITIONS.remove(defId);
- synchronized (alertsStore) {
- alertsStore.remove(defId);
- }
- /* TODO: add code to retry on failure */
- notifyMembersForAlertDefinitionRemoval(alertDefinition);
- }
+ StatAlertDefinition alertDefinition = (StatAlertDefinition) ALERT_DEFINITIONS.get(defId);
+ if (alertDefinition != null) {
+ ALERT_DEFINITIONS.remove(defId);
+ synchronized (alertsStore) {
+ alertsStore.remove(defId);
+ }
+ /* TODO: add code to retry on failure */
+ notifyMembersForAlertDefinitionRemoval(alertDefinition);
+ }
}
if (logger.isDebugEnabled()) {
logger.debug("Exiting AdminDistributedSystemJmxImpl.removeAlertDefinition() *****");
}
}
- /**
+ /**
* Convenience method to check whether an alert definition is created.
*
* @param alertDefinition alert definition to check whether already created
- * @return true if the alert definition is already created, false
- * otherwise
+ * @return true if the alert definition is already created, false otherwise
* @since GemFire 5.7
*/
public boolean isAlertDefinitionCreated(StatAlertDefinition alertDefinition) {
/*
- * Need to maintain a map of stat against the StatAlertDefinitions.
- * check in that map whether the alert definition is there for the given
- * alert
+ * Need to maintain a map of stat against the StatAlertDefinitions. check in that map whether
+ * the alert definition is there for the given alert
*
* TODO: optimize to use Map.containsKey - DONE
*/
- synchronized(ALERT_DEFINITIONS) {
+ synchronized (ALERT_DEFINITIONS) {
return ALERT_DEFINITIONS.containsKey(Integer.valueOf(alertDefinition.getId()));
}
}
@@ -1685,29 +1690,27 @@ public class AdminDistributedSystemJmxImpl
*/
public synchronized int getRefreshIntervalForStatAlerts() {
/*
- * state to store the refresh interval set by the user/GFMon client
+ * state to store the refresh interval set by the user/GFMon client
*/
return refreshIntervalForStatAlerts;
}
/**
- * This method is used to set the refresh interval for the Stats in
- * seconds
+ * This method is used to set the refresh interval for the Stats in seconds
*
* @param refreshIntervalForStatAlerts refresh interval for the Stats(in seconds)
* @since GemFire 5.7
*/
public synchronized void setRefreshIntervalForStatAlerts(int refreshIntervalForStatAlerts) {
/*
- * change the state refresh interval here.
+ * change the state refresh interval here.
*/
this.refreshIntervalForStatAlerts = refreshIntervalForStatAlerts;
- notifyMembersForRefreshIntervalChange(this.refreshIntervalForStatAlerts*1000l);
+ notifyMembersForRefreshIntervalChange(this.refreshIntervalForStatAlerts * 1000l);
}
/**
- * Returns whether Statistics Alert definitions could be persisted across
- * runs/sessions
+ * Returns whether Statistics Alert definitions could be persisted across runs/sessions
*
* @return value of canPersistStatAlertDefs.
* @since GemFire 6.5
@@ -1722,154 +1725,150 @@ public class AdminDistributedSystemJmxImpl
* @param newInterval refresh interval to be set for members(in milliseconds)
*/
private void notifyMembersForRefreshIntervalChange(long newInterval) {
- GfManagerAgent agent = getGfManagerAgent();
- ApplicationVM[] VMs = agent.listApplications();
- //TODO: is there any other way to get all VMs?
-
+ GfManagerAgent agent = getGfManagerAgent();
+ ApplicationVM[] VMs = agent.listApplications();
+ // TODO: is there any other way to get all VMs?
+
for (int i = 0; i < VMs.length; i++) {
VMs[i].setRefreshInterval(newInterval);
}
}
-
+
/**
- * An intermediate method to notify all members for change in stat alert
- * definition.
+ * An intermediate method to notify all members for change in stat alert definition.
*
* @param alertDef stat alert definition that got changed
- */
+ */
private void notifyMembersForAlertDefinitionChange(StatAlertDefinition alertDef) {
if (logger.isDebugEnabled()) {
- logger.debug("Entered AdminDistributedSystemJmxImpl.notifyMembersForAlertDefinitionChange(StatAlertDefinition) *****");
+ logger.debug(
+ "Entered AdminDistributedSystemJmxImpl.notifyMembersForAlertDefinitionChange(StatAlertDefinition) *****");
}
- GfManagerAgent agent = getGfManagerAgent();
+ GfManagerAgent agent = getGfManagerAgent();
StatAlertDefinition[] alertDefs = new StatAlertDefinition[] {alertDef};
- ApplicationVM[] VMs = agent.listApplications();
-
+ ApplicationVM[] VMs = agent.listApplications();
+
for (int i = 0; i < VMs.length; i++) {
- VMs[i].updateAlertDefinitions(alertDefs,
+ VMs[i].updateAlertDefinitions(alertDefs,
UpdateAlertDefinitionMessage.UPDATE_ALERT_DEFINITION);
}
if (logger.isDebugEnabled()) {
- logger.debug("Exiting AdminDistributedSystemJmxImpl.notifyMembersForAlertDefinitionChange(StatAlertDefinition) "
- + VMs.length+" members notified.*****");
+ logger.debug(
+ "Exiting AdminDistributedSystemJmxImpl.notifyMembersForAlertDefinitionChange(StatAlertDefinition) "
+ + VMs.length + " members notified.*****");
}
}
/**
- * An intermediate method to notify all members for removal of stat alert
- * definition.
+ * An intermediate method to notify all members for removal of stat alert definition.
*
* @param alertDef stat alert definition to be removed
*/
private void notifyMembersForAlertDefinitionRemoval(StatAlertDefinition alertDef) {
- GfManagerAgent agent = getGfManagerAgent();
+ GfManagerAgent agent = getGfManagerAgent();
StatAlertDefinition[] alertDefs = new StatAlertDefinition[] {alertDef};
- ApplicationVM[] VMs = agent.listApplications();
-
+ ApplicationVM[] VMs = agent.listApplications();
+
for (int i = 0; i < VMs.length; i++) {
- VMs[i].updateAlertDefinitions(alertDefs,
+ VMs[i].updateAlertDefinitions(alertDefs,
UpdateAlertDefinitionMessage.REMOVE_ALERT_DEFINITION);
}
}
/**
- * This method can be used to set the AlertsManager for the newly joined
- * member VM.
+ * This method can be used to set the AlertsManager for the newly joined member VM.
*
* @param memberVM Member VM to set AlertsManager for
* @since GemFire 5.7
*/
public synchronized void setAlertsManager(GemFireVM memberVM) {
/*
- * 1. Who'll call this method? Who gets notified when a member joins?
- * I think that's AdminDistributedSystemJmxImpl.nodeCreated()
- * 2. Is the argument GemFireVM correct? Need to modify this interface to
- * add method to set an interface. Need to see how it can be passed to
- * the RemoteGemFireVM implementation. Also need to check whetherother
- * implementors (like DistributedSystemHealthMonitor) of GemFireVM even
- * need to have the AlertsManager
- * 3. Would the alerts manager be set by aggregator or a JMXAgent i.e. AdminDistributedSystemJmxImpl
- * 4. Setting the list of available alert definitions & refresh interval at
- * this moment only would be better/easier.
- * 5. Need to know Alerts Manager creation/construction. Need to decide how
- * the object would be set & sent across to the Agent VM.
+ * 1. Who'll call this method? Who gets notified when a member joins? I think that's
+ * AdminDistributedSystemJmxImpl.nodeCreated() 2. Is the argument GemFireVM correct? Need to
+ * modify this interface to add method to set an interface. Need to see how it can be passed to
+ * the RemoteGemFireVM implementation. Also need to check whetherother implementors (like
+ * DistributedSystemHealthMonitor) of GemFireVM even need to have the AlertsManager 3. Would the
+ * alerts manager be set by aggregator or a JMXAgent i.e. AdminDistributedSystemJmxImpl 4.
+ * Setting the list of available alert definitions & refresh interval at this moment only would
+ * be better/easier. 5. Need to know Alerts Manager creation/construction. Need to decide how
+ * the object would be set & sent across to the Agent VM.
*/
if (logger.isDebugEnabled()) {
logger.debug("Entered AdminDistributedSystemJmxImpl.setAlertsManager(GemFireVM) *****");
}
-
+
// creating an array of stat alert definition objects
StatAlertDefinition[] alertDefs = new StatAlertDefinition[0];
-
+
Collection alertDefsCollection = null;
- synchronized(ALERT_DEFINITIONS) {
+ synchronized (ALERT_DEFINITIONS) {
alertDefsCollection = ALERT_DEFINITIONS.values();
}
-
- alertDefs = (StatAlertDefinition[])alertDefsCollection.toArray(alertDefs);
-
- memberVM.setAlertsManager(alertDefs, getRefreshIntervalForStatAlerts()*1000l, true);
-
+
+ alertDefs = (StatAlertDefinition[]) alertDefsCollection.toArray(alertDefs);
+
+ memberVM.setAlertsManager(alertDefs, getRefreshIntervalForStatAlerts() * 1000l, true);
+
if (logger.isDebugEnabled()) {
logger.debug("Exiting AdminDistributedSystemJmxImpl.setAlertsManager(GemFireVM) *****");
}
}
- /**
- * This method can be used to retrieve all available stat alert definitions.
- * Returns empty array if there are no stat alert definitions defined.
+ /**
+ * This method can be used to retrieve all available stat alert definitions. Returns empty array
+ * if there are no stat alert definitions defined.
*
- * @return An array of all available StatAlertDefinition objects
+ * @return An array of all available StatAlertDefinition objects
* @since GemFire 5.7
*/
public StatAlertDefinition[] getAllStatAlertDefinitions() {
if (logger.isDebugEnabled()) {
logger.debug("Entered AdminDistributedSystemJmxImpl.getAllStatAlertDefinitions() *****");
}
-
+
Collection alertDefs = null;
- synchronized(ALERT_DEFINITIONS) {
+ synchronized (ALERT_DEFINITIONS) {
alertDefs = ALERT_DEFINITIONS.values();
}
-
+
StatAlertDefinition[] alertDefsArr = null;
-
+
if (alertDefs != null) {
alertDefsArr = new StatAlertDefinition[alertDefs.size()];
- alertDefsArr = (StatAlertDefinition[])alertDefs.toArray(alertDefsArr);
+ alertDefsArr = (StatAlertDefinition[]) alertDefs.toArray(alertDefsArr);
} else {
alertDefsArr = new StatAlertDefinition[0];
}
-
+
if (logger.isDebugEnabled()) {
logger.debug("Exiting AdminDistributedSystemJmxImpl.getAllStatAlertDefinitions() *****");
}
-
+
return alertDefsArr;
}
/**
- * This method can be used to process the notifications sent by the
- * member(s). Actual aggregation of stats can occur here. The array contains
- * alert objects with alert def. ID & value. AlertHelper class can be used to
- * retrieve the corresponding alert definition.
+ * This method can be used to process the notifications sent by the member(s). Actual aggregation
+ * of stats can occur here. The array contains alert objects with alert def. ID & value.
+ * AlertHelper class can be used to retrieve the corresponding alert definition.
*
* @param alerts array of Alert class(contains alert def. ID & value)
- * @param remoteVM Remote Member VM that sent Stat Alerts for processing the
- * notifications to the clients
- */
+ * @param remoteVM Remote Member VM that sent Stat Alerts for processing the notifications to the
+ * clients
+
<TRUNCATED>