You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Jeremy Volkman <jv...@gmail.com> on 2006/05/01 16:51:47 UTC

Event Admin: BundleContext.ungetService

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.  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?

Jeremy

Re: Event Admin: BundleContext.ungetService

Posted by Jeremy Volkman <jv...@gmail.com>.
On 5/1/06, Richard S. Hall <he...@ungoverned.org> wrote:
>
> 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.
>

Oops. Thanks for pointing that out.

>
> -> richard
>

Jeremy

Re: Event Admin: BundleContext.ungetService

Posted by "Richard S. Hall" <he...@ungoverned.org>.
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

Re: Event Admin: BundleContext.ungetService

Posted by Karl Pauls <ka...@gmail.com>.
> 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.

This is fairly easy to fix. I'll commit a patch tonight.

> Jeremy

Thanks for catching that.

regards,

Karl

--
Karl Pauls
karlpauls@gmail.com