use of com.alipay.sofa.runtime.api.component.ComponentLifeCycle in project sofa-boot by alipay.
the class ExtensionPointComponent method deactivate.
@Override
public void deactivate() throws ServiceRuntimeException {
ComponentManager componentManager = sofaRuntimeContext.getComponentManager();
for (ComponentInfo componentInfo : componentManager.getComponents()) {
if (componentInfo.getType().equals(ExtensionComponent.EXTENSION_COMPONENT_TYPE)) {
ExtensionComponent extensionComponent = (ExtensionComponent) componentInfo;
if (extensionComponent.getExtension().getTargetComponentName().equals(componentName)) {
componentManager.unregister(componentInfo);
}
}
}
if (componentStatus != ComponentStatus.ACTIVATED) {
return;
}
// skip deactivate SpringImplementationImpl because it's already deactivated
if (this.implementation != null && !(implementation instanceof SpringImplementationImpl)) {
Object target = this.implementation.getTarget();
if (target instanceof ComponentLifeCycle) {
((ComponentLifeCycle) target).deactivate();
}
}
componentStatus = ComponentStatus.RESOLVED;
}
use of com.alipay.sofa.runtime.api.component.ComponentLifeCycle in project sofa-boot by sofastack.
the class ExtensionPointComponent method deactivate.
@Override
public void deactivate() throws ServiceRuntimeException {
ComponentManager componentManager = sofaRuntimeContext.getComponentManager();
for (ComponentInfo componentInfo : componentManager.getComponents()) {
if (componentInfo.getType().equals(ExtensionComponent.EXTENSION_COMPONENT_TYPE)) {
ExtensionComponent extensionComponent = (ExtensionComponent) componentInfo;
if (extensionComponent.getExtension().getTargetComponentName().equals(componentName)) {
componentManager.unregister(componentInfo);
}
}
}
if (componentStatus != ComponentStatus.ACTIVATED) {
return;
}
// skip deactivate SpringImplementationImpl because it's already deactivated
if (this.implementation != null && !(implementation instanceof SpringImplementationImpl)) {
Object target = this.implementation.getTarget();
if (target instanceof ComponentLifeCycle) {
((ComponentLifeCycle) target).deactivate();
}
}
componentStatus = ComponentStatus.RESOLVED;
}
Aggregations