[Bugfix] fixed problem stopping component that throws exception
Now we are sure that if a component fails to stop or destroy, we catch the situation and carry on stopping the others. This handling is not done when starting, as there we don't want to finish starting the agent if something goes wrong.
This commit is contained in:
parent
2894b5b157
commit
8f382caac6
|
@ -199,7 +199,13 @@ public class ComponentContainerImpl implements ComponentContainer {
|
||||||
String msg = "Stopping component {0}..."; //$NON-NLS-1$
|
String msg = "Stopping component {0}..."; //$NON-NLS-1$
|
||||||
String componentName = component.getName();
|
String componentName = component.getName();
|
||||||
logger.info(MessageFormat.format(msg, componentName));
|
logger.info(MessageFormat.format(msg, componentName));
|
||||||
|
try {
|
||||||
component.stop();
|
component.stop();
|
||||||
|
} catch (Exception e) {
|
||||||
|
msg = "Failed to stop component {0} due to {1}";
|
||||||
|
msg = MessageFormat.format(msg, componentName, e.getMessage());
|
||||||
|
logger.error(msg, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop direct upstream components
|
// Stop direct upstream components
|
||||||
|
@ -219,7 +225,13 @@ public class ComponentContainerImpl implements ComponentContainer {
|
||||||
String msg = "Destroying component {0}..."; //$NON-NLS-1$
|
String msg = "Destroying component {0}..."; //$NON-NLS-1$
|
||||||
String componentName = component.getName();
|
String componentName = component.getName();
|
||||||
logger.info(MessageFormat.format(msg, componentName));
|
logger.info(MessageFormat.format(msg, componentName));
|
||||||
|
try {
|
||||||
component.destroy();
|
component.destroy();
|
||||||
|
} catch (Exception e) {
|
||||||
|
msg = "Failed to destroy component {0} due to {1}";
|
||||||
|
msg = MessageFormat.format(msg, componentName, e.getMessage());
|
||||||
|
logger.error(msg, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy direct upstream components
|
// Destroy direct upstream components
|
||||||
|
|
Loading…
Reference in New Issue