Services are not “stopped” because they are not threads, nor do they “run”.
You can unregister a service, and yes you can do this when another service you
depend on goes away. The best way to do this is with Declarative Services,
which can create a mandatory dependency as follows:
@Component // provides the “A” service
public class AImpl implements A {
@Reference
private B b;
}
This creates a mandatory reference from your A component to the B service. If
the B service goes away, then your A component will be destroyed and the A
service will be unregistered.
Regards,
Neil
> On 10 Feb 2016, at 15:19, Hubert Felber <[email protected]> wrote:
>
> Hi,
>
> I would like to send a stop to a service running in another bundle ?
> Can this be done?
>
> Explanation:
>
> Service B in Bundle B has a dependency on Service A in Bundle A , so B
> will stop a f t e r service A stopped. Service A knows the service B
> .
> I want to stop service B as soon as service A reveceives a stop and b
> e f o r e service A has finally stopped , not after.
>
> Is there a way?
>
> Thank you
> Regards
> Hubert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]