modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 19 +++++++--- 1 file changed, 14 insertions(+), 5 deletions(-)
New commits: commit f819631220c83f1ae8874953035e60720e61cff4 Author: John Mazzitelli mazz@redhat.com Date: Thu Feb 2 13:32:01 2012 -0500
[BZ 768706] add some more code to make sure we do proper error correction/checking
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 fc5be1c..3d30b83 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 @@ -1463,6 +1463,7 @@ public class InventoryManager extends AgentService implements ContainerService, // state is a transient field, so reinitialize it just in case this is invoked just after loadFromDisk() if (state == null) { container.setResourceComponentState(ResourceComponentState.STOPPED); + state = ResourceComponentState.STOPPED; }
// if the component exists and is not stopped then we may not have to do anything @@ -1589,11 +1590,19 @@ public class InventoryManager extends AgentService implements ContainerService, if (prepareResourceForActivation(resource, container, updatedPluginConfig)) { container.setResourceComponentState(ResourceComponentState.STARTING);
- ResourceContext context = container.getResourceContext(); + ResourceContext context; + ResourceComponent component;
- // Wrap the component in a proxy that will provide locking and a timeout for the call to start(). - ResourceComponent component = container.createResourceComponentProxy(ResourceComponent.class, - FacetLockType.READ, COMPONENT_START_TIMEOUT, true, false); + try { + context = container.getResourceContext(); + + // Wrap the component in a proxy that will provide locking and a timeout for the call to start(). + component = container.createResourceComponentProxy(ResourceComponent.class, FacetLockType.READ, + COMPONENT_START_TIMEOUT, true, false); + } catch (Throwable t) { + container.setResourceComponentState(ResourceComponentState.STOPPED); + throw new PluginContainerException("Failed getting proxy for resource " + resource + ".", t); + }
try { component.start(context); @@ -2889,4 +2898,4 @@ public class InventoryManager extends AgentService implements ContainerService, // nothing to do } } -} \ No newline at end of file +}
rhq-commits@lists.fedorahosted.org