modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java | 16 +++- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java | 38 ++++++---- 2 files changed, 36 insertions(+), 18 deletions(-)
New commits: commit 2af8a30457557a8f3e99ff954c0d2611ba71e994 Author: John Mazzitelli mazz@redhat.com Date: Fri Oct 25 16:04:34 2013 -0400
BZ 1023332 - cherry picked from 1b7f2f3
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java index a9788b1..475f84c 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java @@ -161,11 +161,19 @@ public class AgentManagerBean implements AgentManagerLocal { ServerCommunicationsServiceMBean bootstrap = ServerCommunicationsServiceUtil.getService(); client = bootstrap.getKnownAgentClient(agent);
- // We assume the caller is asking for a client so it can send the agent messages, - // so let's start the sender automatically for the caller so it doesn't need to remember to do it - client.startSending(); + if (client != null) { + // We assume the caller is asking for a client so it can send the agent messages, + // so let's start the sender automatically for the caller so it doesn't need to remember to do it + client.startSending(); + } else { + if (LOG.isDebugEnabled()) { + LOG.debug("There is no agent client for agent: " + agent); + } + } } catch (Throwable t) { - log.debug("Could not get agent client for " + agent); + if (LOG.isDebugEnabled()) { + LOG.debug("Could not get agent client for agent: " + agent, t); + } }
return client; diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java index 09b6271..2f75d6e 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java @@ -421,24 +421,34 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
for (Resource platform : platforms) { AgentClient agentClient = agentManager.getAgentClient(platform.getAgent()); - try { - syncInfo = entityManager.find(ResourceSyncInfo.class, platform.getId()); - agentClient.getDiscoveryAgentService().synchronizeInventory(syncInfo); - } catch (Exception e) { - LOG.warn("Could not perform commit synchronization with agent for platform [" + platform.getName() - + "]", e); + if (agentClient != null) { + try { + syncInfo = entityManager.find(ResourceSyncInfo.class, platform.getId()); + agentClient.getDiscoveryAgentService().synchronizeInventory(syncInfo); + } catch (Exception e) { + LOG.warn("Could not perform commit synchronization with agent for platform [" + platform.getName() + + "]", e); + } + } else { + LOG.warn("Could not perform commit sync with agent for platform [" + platform.getName() + + "]; will expect agent to do it later"); } } for (Resource server : servers) { // Only update servers if they haven't already been updated at the platform level if (!platforms.contains(server.getParentResource())) { AgentClient agentClient = agentManager.getAgentClient(server.getAgent()); - try { - syncInfo = entityManager.find(ResourceSyncInfo.class, server.getId()); - agentClient.getDiscoveryAgentService().synchronizeInventory(syncInfo); - } catch (Exception e) { - LOG.warn("Could not perform commit synchronization with agent for server [" + server.getName() - + "]", e); + if (agentClient != null) { + try { + syncInfo = entityManager.find(ResourceSyncInfo.class, server.getId()); + agentClient.getDiscoveryAgentService().synchronizeInventory(syncInfo); + } catch (Exception e) { + LOG.warn("Could not perform commit synchronization with agent for server [" + server.getName() + + "]", e); + } + } else { + LOG.warn("Could not perform commit sync with agent for server [" + server.getName() + + "]; will expect agent to do it later"); } } } @@ -703,10 +713,10 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot }
// If provided, assume the new plugin config should replace the old plugin config in its entirety. - // Use a deep copy without ids as the updgardeRequest config may contain entity config props. + // Use a deep copy without ids as the updgardeRequest config may contain entity config props. // Note: we explicitly do not call configurationManager.updatePluginConfiguration() because the // agent is already updated to the new configuration. Instead we call the dedicated local method - // supporting this use case. + // supporting this use case. Configuration pluginConfig = upgradeRequest.getNewPluginConfiguration(); if (null != pluginConfig) { pluginConfig = pluginConfig.deepCopy(false);
rhq-commits@lists.fedorahosted.org