[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] bug or not




On Mon, Apr 28, 2014 at 5:17 PM, Thomas Watson <tjwatson@xxxxxxxxxx> wrote:

You seem to be implementing the work that the framework already does for ServiceFactory registrations. ÂThe framework will only call your factory once as long as the use count of the service is greater than zero for a particular bundle. ÂThe framework will then cache that service instance and keep returning it directly to the bundle without calling the ServiceFactory again.

Am I understanding your observation correctly? ÂYou are stating that your factory is not called multiple times for the same consuming bundle?


I'm stating that when a single bundle is deployed which requests the same service multiple times the factory method is called multiple times and the bundle gets a different instance of the service each time.

I'm not sure if there is some sort of race condition but the client bundle (in this case the felix webconsole) is requesting the HttpService mutliple times (in the same thread) and each time the equinox framework is invoking the HttpServiceFactory method returning different HttpServiceImpl instance.

- Ray
Â



Tom



Inactive hide details for Raymond Auge ---04/28/2014 03:24:26 PM---Hey all, I have to write code as follows in a ServiceFactoryRaymond Auge ---04/28/2014 03:24:26 PM---Hey all, I have to write code as follows in a ServiceFactory impl in order for my



From: Raymond Auge <raymond.auge@xxxxxxxxxxx>
To: Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
Date: 04/28/2014 03:24 PM

Subject: [equinox-dev] bug or not
Sent by: equinox-dev-bounces@xxxxxxxxxxx




Hey all,

I have to write code as followsÂin a ServiceFactory impl in order for my factory to always return the same instance per bundle running on equinoxÂ3.8.0.v20120529-1548

===============================================

public HttpService getService(
Bundle bundle, ServiceRegistration<HttpService> registration) {

HttpServiceImpl httpServiceImpl = serviceMap.get(bundle);

if (httpServiceImpl != null) {
return httpServiceImpl;
}

httpServiceImpl = new HttpServiceImpl(
bundle, contextController, legacyServiceIdGenerator);

serviceMap.putIfAbsent(bundle, httpServiceImpl);

return httpServiceImpl;
}
===============================================

This seems clearly wrong as per the spec.Â


It's certainly calling the getService method of the ServiceFactory which I'm guessing means it's not incorrectly registered.

What could I be doing wrong? Was this ever a bug in equinox that was later resolved?


--
Raymond AugÃÂ(@rotty3000)
Senior Software Architect
Liferay, Inc.Â(@Liferay)
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev


_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev




--
Raymond AugÃÂ(@rotty3000)
Senior Software Architect
Liferay, Inc.Â(@Liferay)

GIF image