return false;
}
ResourceComponent component = container.getResourceComponent();
ResourceComponentState state = container.getResourceComponentState();
// 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
if ((component != null) && (state != ResourceComponentState.STOPPED)) {
// if STARTED and we are forced to restart (e.g. plugin config change), then stop the component
// and continue. If STARTING just let it continue to start as interruption could put us in a bad state.
if (forceReinitialization) {
switch (state) {
case STARTED:
if (log.isDebugEnabled()) {
log.debug("Forcing re-initialization of an already started resource: " + resource);
}
deactivateResource(resource);
break;
case STARTING:
log.warn("Could not force initialization of component for resource [" + resource.getId()
+ "] as it is already in the process of starting.");
return false;
default:
log.error("Unexpected state [" + state.name() + "], returning false...");
return false;
}
} else {
if (log.isTraceEnabled()) {