On Mar 18, 2014, at 10:49 AM, Bertrand Delacretaz <[email protected]> wrote:
> Hi, > > I'd like to interact with a given service as soon as it is created, ideally > before other clients use it. You can't guarantee that any particular request for the service from the service registry will be the first one. > > Is it safe to use a service in the > ServiceListener.serviceChanged(ServiceReference R) method, grabbing it from > R? Yes. There's no way to make sure your service listener gets notified before anyone else, or before queries against the service registry. > > I suppose there's no way to prioritize a given ServiceListener, but at > least my code would run as soon as the service becomes available. > > Or is there a better way? I'm biased, but I think DS is a better way :-). If you have a DS component with a reference to your desired service, with a bind method, the bind method will be called at some point when the desired service is available, whether the service or your component starts first. If you make it a required reference then your component will start only when the service is available. hope this helps david jencks > > -Bertrand --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

