I have an OSGi component:
@Component(immediate=true)
public class SomeComponent implements SomeInterface {...}
Note that the component is immediate. Also, since the component class is implementing an interface, I understand that a service will be registered automatically upon (as part of the) activation of the component.
Now, I would like to do be able to dynamically interrupt the component activation and service registration if certain conditions are met. Throwing a 'ComponentException' in a component activator doesn't seem to do the job:
@Activate
public void activate() {
if (notReady)
throw new ComponentException("Component not ready");
}
Any suggestions? Thanks!