[jopr-commits] JOPR SVN: r1230 - in trunk/modules/plugins: jboss-as/src/main/resources/META-INF and 2 other directories.
jopr-commits at lists.jboss.org
jopr-commits at lists.jboss.org
Sat Sep 26 11:39:11 EDT 2009
Author: mazz
Date: 2009-09-26 11:39:11 -0400 (Sat, 26 Sep 2009)
New Revision: 1230
Modified:
trunk/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java
trunk/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java
trunk/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
trunk/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java
trunk/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
Log:
[JOPR-384] to avoid slow-responding jboss-as 4/5 servers from triggering false "downs", allow for plugins to be configurable for async avail checking. the default is the same as its always been - synchronous avail checking. if the 5-second avail timeout gets triggered because the jboss-as servers are slow to reply to the ping, then you turn on async avail checking
Modified: trunk/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java
===================================================================
--- trunk/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java 2009-09-23 18:21:41 UTC (rev 1229)
+++ trunk/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java 2009-09-26 15:39:11 UTC (rev 1230)
@@ -73,6 +73,8 @@
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable;
+import org.rhq.core.pluginapi.availability.AvailabilityFacet;
import org.rhq.core.pluginapi.content.ContentContext;
import org.rhq.core.pluginapi.content.ContentFacet;
import org.rhq.core.pluginapi.content.ContentServices;
@@ -131,6 +133,7 @@
public static final String SHUTDOWN_MBEAN_OPERATION_CONFIG_PROP = "shutdownMbeanOperation";
public static final String SHUTDOWN_METHOD_CONFIG_PROP = "shutdownMethod";
public static final String JAVA_HOME_PATH_CONFIG_PROP = "javaHomePath";
+ public static final String AVAIL_CHECK_PERIOD_CONFIG_PROP = "availabilityCheckPeriod";
public static final String BINDING_ADDRESS_CONFIG_PROP = "bindingAddress";
@@ -197,6 +200,8 @@
private MainDeployer mainDeployer;
+ private AvailabilityCollectorRunnable availCollector;
+
// ResourceComponent Implementation --------------------------------------------
public void start(ResourceContext context) throws Exception {
@@ -251,9 +256,33 @@
this.logFileEventDelegate = new LogFileEventResourceComponentHelper(this.resourceContext);
this.logFileEventDelegate.startLogFileEventPollers();
+
+ // prepare to perform async avail checking
+ String availCheckPeriodProp = pluginConfig.getSimpleValue(AVAIL_CHECK_PERIOD_CONFIG_PROP, null);
+ if (availCheckPeriodProp != null) {
+ try {
+ long availCheckMillis = Integer.parseInt(availCheckPeriodProp) * 1000L;
+ this.availCollector = resourceContext.createAvailabilityCollectorRunnable(new AvailabilityFacet() {
+ public AvailabilityType getAvailability() {
+ return getAvailabilityNow();
+ }
+ }, availCheckMillis);
+ this.availCollector.start();
+ } catch (NumberFormatException nfe) {
+ log.error("avail check period config prop was not a valid number. Cause: " + nfe);
+ this.availCollector = null;
+ }
+ }
+
+ return;
}
public void stop() {
+ if (this.availCollector != null) {
+ this.availCollector.stop();
+ this.availCollector = null;
+ }
+
this.logFileEventDelegate.stopLogFileEventPollers();
if (this.connection != null) {
try {
@@ -266,6 +295,14 @@
}
public AvailabilityType getAvailability() {
+ if (this.availCollector != null) {
+ return this.availCollector.getLastKnownAvailability();
+ } else {
+ return getAvailabilityNow();
+ }
+ }
+
+ private AvailabilityType getAvailabilityNow() {
try {
EmsConnection connection = loadConnection();
EmsBean bean = connection.getBean("jboss.system:type=ServerConfig");
Modified: trunk/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml 2009-09-23 18:21:41 UTC (rev 1229)
+++ trunk/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml 2009-09-26 15:39:11 UTC (rev 1230)
@@ -144,6 +144,12 @@
description="Name of the operation to invoke when shutting down this server through JMX.
Note that only operations with no parameter or with one int parameter are supported. If the
operation requires an int parameter, '0' will be supplied."/>
+ <c:simple-property name="availabilityCheckPeriod" description="The amount of time, in seconds, that must elapse between availability checks to see if the server is up. If set, the availability checks will be performed asynchronously thus allowing slow-responding servers to avoid being falsely reported as down."
+ units="seconds" required="false" type="integer">
+ <c:constraint>
+ <c:integer-constraint minimum="60"/>
+ </c:constraint>
+ </c:simple-property>
</c:group>
</plugin-configuration>
Modified: trunk/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java
===================================================================
--- trunk/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java 2009-09-23 18:21:41 UTC (rev 1229)
+++ trunk/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java 2009-09-26 15:39:11 UTC (rev 1230)
@@ -75,6 +75,8 @@
import org.rhq.core.domain.resource.CreateResourceStatus;
import org.rhq.core.domain.resource.ResourceCreationDataType;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable;
+import org.rhq.core.pluginapi.availability.AvailabilityFacet;
import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.core.pluginapi.content.ContentContext;
@@ -132,7 +134,17 @@
private ApplicationServerOperationsDelegate operationDelegate;
private LogFileEventResourceComponentHelper logFileEventDelegate;
+ private AvailabilityCollectorRunnable availCollector;
+
public AvailabilityType getAvailability() {
+ if (this.availCollector != null) {
+ return this.availCollector.getLastKnownAvailability();
+ } else {
+ return getAvailabilityNow();
+ }
+ }
+
+ private AvailabilityType getAvailabilityNow() {
connectToProfileService();
AvailabilityType availability;
if (this.connection != null) {
@@ -183,9 +195,34 @@
this.contentFacetDelegate = new ApplicationServerContentFacetDelegate(workflowManager, configPath,
resourceContext.getContentContext());
+
+ // prepare to perform async avail checking
+ Configuration pc = resourceContext.getPluginConfiguration();
+ String availCheckPeriodProp = pc.getSimpleValue(ApplicationServerPluginConfigurationProperties.AVAIL_CHECK_PERIOD_CONFIG_PROP, null);
+ if (availCheckPeriodProp != null) {
+ try {
+ long availCheckMillis = Integer.parseInt(availCheckPeriodProp) * 1000L;
+ this.availCollector = resourceContext.createAvailabilityCollectorRunnable(new AvailabilityFacet() {
+ public AvailabilityType getAvailability() {
+ return getAvailabilityNow();
+ }
+ }, availCheckMillis);
+ this.availCollector.start();
+ } catch (NumberFormatException nfe) {
+ log.error("avail check period config prop was not a valid number. Cause: " + nfe);
+ this.availCollector = null;
+ }
+ }
+
+ return;
}
public void stop() {
+ if (this.availCollector != null) {
+ this.availCollector.stop();
+ this.availCollector = null;
+ }
+
this.logFileEventDelegate.stopLogFileEventPollers();
disconnectFromProfileService();
this.jmxConnectionHelper.closeConnection();
Modified: trunk/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java
===================================================================
--- trunk/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java 2009-09-23 18:21:41 UTC (rev 1229)
+++ trunk/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java 2009-09-26 15:39:11 UTC (rev 1230)
@@ -40,6 +40,7 @@
static final String SHUTDOWN_MBEAN_OPERATION_CONFIG_PROP = "shutdownMBeanOperation";
static final String SHUTDOWN_METHOD_CONFIG_PROP = "shutdownMethod";
static final String SCRIPT_PREFIX_CONFIG_PROP = "scriptPrefix";
+ static final String AVAIL_CHECK_PERIOD_CONFIG_PROP = "availabilityCheckPeriod";
private ApplicationServerPluginConfigurationProperties() {
}
Modified: trunk/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml 2009-09-23 18:21:41 UTC (rev 1229)
+++ trunk/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml 2009-09-26 15:39:11 UTC (rev 1230)
@@ -1015,6 +1015,12 @@
description="Name of the operation to invoke when shutting down this server through JMX.
Note that only operations with no parameter or with one int parameter are supported. If the
operation requires an int parameter, '0' will be supplied."/>
+ <c:simple-property name="availabilityCheckPeriod" description="The amount of time, in seconds, that must elapse between availability checks to see if the server is up. If set, the availability checks will be performed asynchronously thus allowing slow-responding servers to avoid being falsely reported as down."
+ units="seconds" required="false" type="integer">
+ <c:constraint>
+ <c:integer-constraint minimum="60"/>
+ </c:constraint>
+ </c:simple-property>
</c:group>
<c:group name="events">
More information about the jopr-commits
mailing list