From: <ma...@rh...> - 2009-05-27 15:55:03
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [3990] [RHQ-2104] perform a double-check for an MBean registration to workaround https://jira.jboss.org/jira/browse/JBPAPP-2031</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>3990</dd> <dt>Author</dt> <dd>mazz</dd> <dt>Date</dt> <dd>2009-05-27 10:54:53 -0500 (Wed, 27 May 2009)</dd> </dl> <h3>Log Message</h3> <pre>[RHQ-2104] perform a double-check for an MBean registration to workaround https://jira.jboss.org/jira/browse/JBPAPP-2031</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulespluginsjmxsrcmainjavaorgrhqpluginsjmxMBeanResourceComponentjava">rhq/trunk/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/MBeanResourceComponent.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulespluginsjmxsrcmainjavaorgrhqpluginsjmxMBeanResourceComponentjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/MBeanResourceComponent.java (3989 => 3990)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/MBeanResourceComponent.java 2009-05-27 15:44:58 UTC (rev 3989) +++ rhq/trunk/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/MBeanResourceComponent.java 2009-05-27 15:54:53 UTC (rev 3990) </span><span class="lines">@@ -200,7 +200,7 @@ </span><span class="cx"> */ public AvailabilityType getAvailability() { try { </span><span class="rem">- if (getEmsBean().isRegistered()) { </span><span class="add">+ if (isMBeanAvailable()) { </span><span class="cx"> return AvailabilityType.UP; } else { return AvailabilityType.DOWN; </span><span class="lines">@@ -210,7 +210,7 @@ </span><span class="cx"> // Retry by connecting to a new parent connection (this bean might have been connected to by an old // provider that's since been recreated). this.bean = null; </span><span class="rem">- if (getEmsBean().isRegistered()) { </span><span class="add">+ if (isMBeanAvailable()) { </span><span class="cx"> return AvailabilityType.UP; } else { return AvailabilityType.DOWN; </span><span class="lines">@@ -221,6 +221,19 @@ </span><span class="cx"> } } </span><span class="add">+ private boolean isMBeanAvailable() { + EmsBean emsBean = getEmsBean(); + boolean isAvailable = emsBean.isRegistered(); + if (isAvailable == false) { + // in some buggy situations, a remote server might tell us an MBean isn't registered but it really is. + // see JBPAPP-2031 for more + String emsBeanName = emsBean.getBeanName().getCanonicalName(); + int size = emsBean.getConnectionProvider().getExistingConnection().queryBeans(emsBeanName).size(); + isAvailable = (size == 1); + } + return isAvailable; + } + </span><span class="cx"> public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) { this.getValues(report, requests, getEmsBean()); } </span> </pre> </div> </div> </body> </html> |