我有一个OSGi的组件:有效的方法来从中断OSGi的组件被激活
@Component(immediate=true)
public class SomeComponent implements SomeInterface {...}
注意,该组件是即时的。另外,由于组件类正在实现一个接口,因此我明白服务将在组件激活时(作为其一部分)自动注册。
现在,如果满足某些条件,我希望能够动态地中断组件激活和服务注册。在一个组成活化扔“ComponentException”似乎并没有做的工作:
@Activate
public void activate() {
if (notReady)
throw new ComponentException("Component not ready");
}
有什么建议?谢谢!