Hi,

The question is which BundleContext you are using. If your are using the
BundleContext of Bundle A, it is Bundle A registering the service, if
the BundeContext is the one of Bundle B, it is Bundle B registering the
service.

I would strongly suggest to actually use Bundle B's BundleContext, such
that the OSGi service registry may unregister the services when Bundle B
is stopped.

BTW: Have you consider using Declarative Services ?

Regards
Felix

Am Montag, den 22.10.2007, 11:36 +0200 schrieb David Lindelöf:
> Hi Karl,
> 
> On Mon, 2007-10-22 at 11:08 +0200, Karl Pauls wrote:
> > > What exactly happens when bundle A registers services with objects from
> > > bundle B and B subsequently stops?
> > 
> > Are you talking about instance of classes that A imports from B?
> 
> I'm trying to implement the whiteboard pattern in a transparent manner
> for bundle B:
> 
> Bundle A defines a Subscriber interface. Bundle B has objects that
> implement Subscriber.
> 
> Bundle A also defines a Subscribable interface, that looks like
> 
> public interface Subscribable {
>  public void subscribe(Subscriber subscriber);
> }
> 
> Bundle A implements this interface with something like:
> 
> public class SubscribableImpl {
>  public void subscribe(Subscriber subscriber) {
>   context.registerService(Subscriber.class.getName(), subscriber);
>  }
> }
> 
> The subscribers are then notified of events by looking them up in the
> service registry.
> 
> Now what happens if bundle B calls something like:
> 
> Subscribable subscribable = new SubscribableImpl();
> subscribable.subscribe(new Subscriber() {
>  ...});
> 
> And what happens when bundle B subsequently stops?
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to