modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
| 23 ++++++++--
1 file changed, 19 insertions(+), 4 deletions(-)
New commits:
commit 483a1e8352f7fc0d8ade726a8b045488c4190826
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Jul 29 09:10:56 2010 -0400
[BZ 619135] For manual add ensure that component start does not prevent
necessary server sync.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index 0c86f8f..720d1ab 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -283,7 +283,7 @@ public class InventoryManager extends AgentService implements
ContainerService,
return results;
} catch (TimeoutException te) {
log.warn("Discovery for Resources of [" + context.getResourceType()
+ "] has been running for more than "
- + timeout + " milliseconds. This may be a plugin bug.",
te);
+ + timeout + " milliseconds. This may be a plugin bug.", te);
return null;
} catch (BlacklistedException be) {
// Discovery did not run, because the ResourceType was blacklisted during a
prior discovery scan.
@@ -316,8 +316,8 @@ public class InventoryManager extends AgentService implements
ContainerService,
return result;
} catch (TimeoutException te) {
log.warn("Manual add of Resource of type [" +
context.getResourceType() + "] with plugin configuration ["
- + pluginConfig.toString(true) + "] has been running for more
than "
- + timeout + " milliseconds. This may be a plugin bug.",
te);
+ + pluginConfig.toString(true) + "] has been running for more than
" + timeout
+ + " milliseconds. This may be a plugin bug.", te);
return null;
} catch (BlacklistedException be) {
log.debug(ThrowableUtil.getAllMessages(be));
@@ -601,6 +601,8 @@ public class InventoryManager extends AgentService implements
ContainerService,
MergeResourceResponse mergeResourceResponse;
Resource resource = null;
boolean resourceAlreadyExisted = false;
+ Throwable startError = null;
+
try {
ResourceContainer parentResourceContainer =
getResourceContainer(parentResourceId);
ResourceComponent parentResourceComponent =
parentResourceContainer.getResourceComponent();
@@ -692,7 +694,14 @@ public class InventoryManager extends AgentService implements
ContainerService,
if (log.isDebugEnabled()) {
log.debug("Activating resource [" + resource +
"]...");
}
- activateResource(resource, resourceContainer, newPluginConfig);
+ // if it fails to start keep going, we already have the resource in inventory
and
+ // need to coordinate with the server. The new resource will be unavailable
but at least
+ // it will be accessible and editable by the user. Report the start exception
at the end.
+ try {
+ activateResource(resource, resourceContainer, newPluginConfig);
+ } catch (Throwable t) {
+ startError = t;
+ }
// NOTE: We don't mess with inventory status - that's the
server's responsibility.
@@ -708,6 +717,12 @@ public class InventoryManager extends AgentService implements
ContainerService,
newResources.add(resource);
postProcessNewlyCommittedResources(newResources);
performServiceScan(resource.getId());
+
+ if (null != startError) {
+ throw new PluginContainerException("The resource [" + resource
+ + "] has been added but could not be started. Verify the
supplied configuration values: ",
+ startError);
+ }
}
// Catch any other RuntimeExceptions or Errors, so the server doesn't have to
worry about deserializing or
Show replies by date