felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Bartlett <njbartl...@gmail.com>
Subject Re: is it possible to send a stop to a service running in a different bundle ?
Date Wed, 10 Feb 2016 17:12:10 GMT
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 <Hubert.Felber@abacus.ch> 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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message