> Can I run this outside of an activator?  Is it safe to hold an internal
> reference to BundleContext after component activation?

You can run this outside the activator.  You can use an internal reference, or 
you can try this from inside the getService() method:

  BundleContext context = 
BundleReference.class.cast(this.getClass().getClassLoader()).getBundle().getBundleContext();

There may be cases when an internal reference may become invalid (if bundles 
are deployed, stopped, removed, added, etc), but I haven't quite figured that 
one out yet.  I've been using the line above and it seems to do the trick.

Larry 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to