felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: Event Admin: BundleContext.ungetService
Date Mon, 01 May 2006 15:05:38 GMT
Jeremy Volkman wrote:
> I was looking at the new Event Admin code that was released to trunk a
> few days ago, and I noticed that BundleContext.ungetService() is never
> called on service objects for EventHandlers.
> Before reporting a bug (and about that: there is no Event Admin
> component in Jira), I wanted to ask a more general question.

There is an Event Admin component, it just doesn't have any issues 
assigned to it, so it doesn't appear in the initial page...if you create 
an issue you will be able to select the Event Admin component.

> In an
> implementation such as Event Admin, where getService() is called each
> time an EventHandler is interested in an event, the service reference
> count might increase fairly quickly.  How important is this reference
> count to the framework, and does an unnecessarily high reference count
> affect the system at all?

I guess it depends on how the service that is being retrieved is 
implemented. If it is a service factory where the actual service object 
does not exist before calling it, then you are creating service objects 
and letting them hang around and occupy memory when they don't need to 
do so.

If the actual service object is directly registered in the service 
registry, then this is not the case...although there is still some added 
overhead since the framework must keep track of the fact that it is 
caching the service object and its reference count.

I doubt it impacts the system greatly, but perhaps it is cleaner to 
unget if you are done with the service for a while.

-> richard

Mime
View raw message