[BZ 808231] add support for tracking the lifecycle state of the plugin container and its container services
Ian Springer
ian.springer at redhat.com
Mon Apr 2 17:59:39 UTC 2012
I've attached a patch to
https://bugzilla.redhat.com/show_bug.cgi?id=808231 that implements this
enhancement. There are two parts to the patch:
1) the new support for service lifecycle
a) added ContainerServiceState enum with 4 values:
INITIALIZING,
INITIALIZED,
SHUTTING_DOWN,
SHUT_DOWN
b) added "ContainerServiceState getState()" method to
ContainerService interface
c) added two new service base classes, AgentContainerService and
NonAgentContainerService, to implement common functionality
(specifically, i) this.configuration and this.state fields and
associated accessors, and ii) state-aware impls of initialize() and
shutdown()), and refactored all services to extend one of these classes
and
2) checking if a service is being shutdown in certain key locations, and
if it is, aborting further code that will likely throw exceptions due to
the service not being in an initialized state, .e.g. from
AutoDiscoveryExecutor.call():
} catch (Exception e) {
if (inventoryManager.getState() ==
ContainerServiceState.INITIALIZED) {
log.warn("Exception caught while executing server
discovery scan.", e);
report.addError(new ExceptionPackage(Severity.Warning, e));
}
}
Please review the patch and let me know if you see any potential issues.
I've been running with it for a few days and have seen no issues. I
would like to get it committed some time this week, so others working on
the AS7 plugin can benefit from the much-reduced log noise during
execution of the AS7 plugin integration tests.
--
Ian Springer
Principal Software Developer
JBoss Operations Network
Red Hat
ian.springer at redhat.com
More information about the rhq-devel
mailing list