modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyTest.java
| 3 +
modules/enterprise/agent/src/main/resources/log4j.xml
| 5 ++
modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
| 18 ++++++++--
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
| 17 ++++++---
4 files changed, 33 insertions(+), 10 deletions(-)
New commits:
commit 8e7f97567327ba25c4a7023e99afd491ee4ec55b
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Nov 25 15:10:58 2013 -0500
Quiet the Tomcat plugin by switching some INFO logging to DEBUG
diff --git
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
index 7886939..440939f 100644
---
a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
+++
b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
@@ -211,12 +211,16 @@ public class TomcatServerComponent<T extends
ResourceComponent<?>> implements JM
connectionSettings.getControlProperties().setProperty(ConnectionFactory.JAR_TEMP_DIR,
tempDir.getAbsolutePath());
- log.info("Loading connection [" +
connectionSettings.getServerUrl() + "] with install path ["
- + connectionSettings.getLibraryURI() + "] and temp directory
[" + tempDir.getAbsolutePath()
- + "]");
+ if (log.isDebugEnabled()) {
+ log.debug("Loading connection [" +
connectionSettings.getServerUrl() + "] with install path ["
+ + connectionSettings.getLibraryURI() + "] and temp
directory [" + tempDir.getAbsolutePath()
+ + "]");
+ }
} else {
- log.info("Loading connection [" +
connectionSettings.getServerUrl()
- + "] ignoring remote install path [" + catalinaHome +
"]");
+ if (log.isDebugEnabled()) {
+ log.debug("Loading connection [" +
connectionSettings.getServerUrl()
+ + "] ignoring remote install path [" + catalinaHome
+ "]");
+ }
}
ConnectionProvider connectionProvider =
connectionFactory.getConnectionProvider(connectionSettings);
@@ -415,7 +419,8 @@ public class TomcatServerComponent<T extends
ResourceComponent<?>> implements JM
return scriptFile;
}
- private File resolvePathRelativeToHomeDir(@NotNull String path) {
+ private File resolvePathRelativeToHomeDir(@NotNull
+ String path) {
return
resolvePathRelativeToHomeDir(this.resourceContext.getPluginConfiguration(), path);
}
commit 5389dbbfe4b927a603fb2d2369ac87edcc734679
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Nov 25 15:10:27 2013 -0500
Quiet the JMX plugin by:
- suffocating INFO messages generated by EMS's ConnectionFactory
- protecting against an NPE in JMXServerComponent.start when
connections couldn't be made
- dumping stack traces in in JMXServerComponent.star in debug only
diff --git a/modules/enterprise/agent/src/main/resources/log4j.xml
b/modules/enterprise/agent/src/main/resources/log4j.xml
index b135bb8..23a7064 100644
--- a/modules/enterprise/agent/src/main/resources/log4j.xml
+++ b/modules/enterprise/agent/src/main/resources/log4j.xml
@@ -91,6 +91,11 @@
</category>
-->
+ <!-- EMS connection factory can be noisy with its INFO messages - comment the below
to see them. -->
+ <category name="org.mc4j.ems.connection.ConnectionFactory">
+ <priority value="WARN"/>
+ </category>
+
<!-- EMS can be noisy with its WARN messages - uncomment the below to suppress
them. -->
<!--
<category name="org.mc4j.ems">
diff --git a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
index 14f43b9..f801cc5 100644
--- a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
+++ b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
@@ -71,9 +71,15 @@ public class JMXServerComponent<T extends
ResourceComponent<?>> implements JMXCo
} catch (Exception e) {
if (e.getCause() instanceof SecurityException) {
throw new InvalidPluginConfigurationException("Failed to
authenticate to managed JVM - "
- + "principal and/or credentials connection properties are
not set correctly.");
+ + "principal and/or credentials connection properties are not
set correctly.");
+ }
+ // don't litter agent log with a stack trace unless we're in debug
+ if (log.isDebugEnabled()) {
+ log.warn("Failed to connect to " + context.getResourceType() +
"[" + context.getResourceKey() + "].", e);
+ } else {
+ log.warn("Failed to connect to " + context.getResourceType() +
"[" + context.getResourceKey() + "]: "
+ + e.getMessage());
}
- log.warn("Failed to connect to " + context.getResourceType() +
"[" + context.getResourceKey() + "].", e);
}
}
@@ -82,13 +88,19 @@ public class JMXServerComponent<T extends
ResourceComponent<?>> implements JMXCo
String connectionTypeDescriptorClassName =
pluginConfig.getSimple(JMXDiscoveryComponent.CONNECTION_TYPE)
.getStringValue();
if (JMXDiscoveryComponent.PARENT_TYPE.equals(connectionTypeDescriptorClassName))
{
- // Our parent is itself a JMX component, so just reuse its connection.
+ // Our parent is itself a JMX component, so just reuse its connection, if it
has one.
this.connection = ((JMXComponent)
context.getParentResourceComponent()).getEmsConnection();
+ if (null == this.connection) {
+ throw new IllegalStateException("Could not access parent connection,
parent may be down");
+ }
this.connectionProvider = this.connection.getConnectionProvider();
} else {
this.connectionProvider =
ConnectionProviderFactory.createConnectionProvider(pluginConfig,
this.context.getNativeProcess(), this.context.getTemporaryDirectory());
this.connection = this.connectionProvider.connect();
+ if (null == this.connection) {
+ throw new IllegalStateException("Failed to create connection,
resource may be down");
+ }
this.connection.loadSynchronous(false);
}
}
commit 61ba50c44f9a5fad9d9d12db9931e6f7a0c2fcb9
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Nov 25 15:06:55 2013 -0500
calls to a component's getAvailbility() impl should return UP or DOWN. In
the case of a timeout on the initial getAvail call to the proxy, it will
convert an UNKNOWN to DOWN.
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyTest.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyTest.java
index aae52a2..e8dd78d 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyTest.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyTest.java
@@ -18,6 +18,7 @@
*/
package org.rhq.core.pc.inventory;
+import static org.rhq.core.domain.measurement.AvailabilityType.DOWN;
import static org.rhq.core.domain.measurement.AvailabilityType.UNKNOWN;
import static org.rhq.core.domain.measurement.AvailabilityType.UP;
import static org.testng.AssertJUnit.assertEquals;
@@ -55,7 +56,7 @@ public class AvailabilityProxyTest implements AvailabilityFacet {
assertEquals("should be up", avail, ap.getAvailability());
assertEquals(false, interrupted);
timeout = 1100;
- assertEquals("should be unknown", UNKNOWN, ap.getAvailability());
+ assertEquals("should be down", DOWN, ap.getAvailability());
Thread.sleep(500); // waited 1.5 sec
assertEquals("should be up now", UP, ap.getAvailability());
Thread.sleep(1); // waited 1.001 seconds
Show replies by date