modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java | 13 +++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
New commits: commit 59c961528beb69f25986b88f4b1a396bfaa9acb7 Author: John Sanda jsanda@redhat.com Date: Wed May 8 17:00:35 2013 -0400
documenting the reason for ignoring exceptions on jmx query
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java index d7a4e9e..bd37510 100644 --- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java +++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/ClusterInitService.java @@ -307,7 +307,18 @@ public final class ClusterInitService { try { nativeTransportRunning = (Boolean) serverConnection.getAttribute(storageService, attribute); } catch (Exception e) { - log.debug("Failed to read attribute [" + attribute + "] from " + storageService, e); + // It is ok to just catch and log exceptions here particularly in an integration + // test environment where we could potentially try to do the JMX query before + // Cassandra is fully initialized. We can query StorageService before the native + // transport server is initialized which will result in Cassandra throwing a NPE. + // We do not want propagate that exception because it is just a matter of waiting + // for Cassandra to finish initializing. + if (log.isDebugEnabled()) { + log.debug("Failed to read attribute [" + attribute + "] from " + storageService, e); + } else { + log.info("Faied to read attribute [" + attribute + "] from " + storageService + ": " + + e.getMessage()); + } } } finally { if (connector != null) {
rhq-commits@lists.fedorahosted.org