modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java | 20 ++++++++-- 1 file changed, 17 insertions(+), 3 deletions(-)
New commits: commit 1718a6e147ee2a698c836685321977561f1f6524 Merge: a5f87a1... 15b395b... Author: Filip Drabek fdrabek@dhcp-lab-136.englab.brq.redhat.com Date: Thu Dec 16 14:44:21 2010 +0100
Merge branch 'release-3.0.0' of ssh://git.fedorahosted.org/git/rhq/rhq into release-3.0.0
commit a5f87a1e536094352beeaa8360da2a7624d9022a Author: Filip Drabek fdrabek@dhcp-lab-136.englab.brq.redhat.com Date: Thu Dec 16 14:43:08 2010 +0100
BZ 638216 - (AS5 plugin) Reconecting to profile service when connection is defunct.
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java index 63a7571..120985a 100644 --- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java +++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java @@ -142,6 +142,7 @@ public class ApplicationServerComponent implements ResourceComponent, ProfileSer AvailabilityType availability; if (this.connection != null) { try { + ManagementView managementView = this.connection.getManagementView(); managementView.load();
@@ -346,10 +347,23 @@ public class ApplicationServerComponent implements ResourceComponent, ProfileSer // ---------------------------------------------------------------
private void connectToProfileService() { - if (this.connection != null) { - return; + if (connection!=null){ + try { + //In rare cases (BZ 638216) connection becomes defunctional. The connection is than not null + //and operations on managementViews will end by timeout. + ManagementView managementView = this.connection.getManagementView(); + managementView.load(); + managementView.getComponentsForType( + new ComponentType("MCBean", "ServerConfig")).iterator().next(); + + return; + }catch(Throwable e){ + log.info("Connection has become defunct. Reconnecting..."); + if (log.isDebugEnabled()) + log.debug("Connection has become defunct. Reconnecting...",e); + } } - // TODO: Check for a defunct connection and if found try to reconnect? + ProfileServiceConnectionProvider connectionProvider; if (runningEmbedded()) { connectionProvider = new LocalProfileServiceConnectionProvider();
rhq-commits@lists.fedorahosted.org