Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] is this a service tracker bug?


This is driving me mad. I have two bundles A and B. B track the service offered by A.

However if I call update on A then I get a remove Service notification but no add Service notification - that is until I issue a refresh command ? is this a bug?

I have written the same simple code 10 time .. see the results.

I have attached the two bundles and the two eclipse plugin projects (as one zip) - just in case a Eclipse/OSGi guru like yourself can figure it out?

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

C:\eg>java -jar equinox.osgi.jar -console

osgi> ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.4.0.v20071207

osgi> install file:bundleA_1.0.0.jar
Bundle id is 1

osgi> install file:bundleB_1.0.0.jar
Bundle id is 2

osgi> ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.4.0.v20071207
1       INSTALLED   bundleA_1.0.0
2       INSTALLED   bundleB_1.0.0

osgi> start 1

osgi> start 2
addingService

osgi> stop 1
removedService

osgi> start 1
addingService

osgi> update 1
removedService <----- no add !

osgi> stop 2

osgi> start 2

osgi> refresh <- Only get add after refresh

osgi> addingService


osgi>


On 25/01/2008, Neil Bartlett <njbartlett@xxxxxxxxx > wrote:
Hi Mark,

Many thanks for your kind words!

Regarding the service tracker problem... that's not the behaviour I would expect to see, and I've just put together a small test case which prints a message in the addingService, removedService and modifiedService methods of the ServiceTracker. When I update the bundle that registered the service, I see the following:

osgi> update 5
Removed service
Added service

osgi>

Which seems to be the way it should work. I suggest posting a message to the equinox-dev mailing list ( https://dev.eclipse.org/mailman/listinfo/equinox-dev) explaining the problem in detail and including a minimal code sample that reproduces the problem.

Regards,
Neil



On 25 Jan 2008, at 13:42, Mark wrote:

Neil,

First off I have to thank you in a big way, because it was you articles that got me up and running on OSGI.

I am also glad that you are putting together a book... because I was thinking about it myself...in practice or in action!, would you like some help?

..Anyway the reason for this mail...

I was looking at the Listeners Considered Harmful: The "Whiteboard" Pattern white paper, and I put together a very simple two bundle example (on Equinox),

Bundle A (offers a service)
Bundle B (consumes service A, using a Service Tracker)

So far so good, and not exactly rocket science.

However this morning I discovered that if you update A - then you must refresh A in order for B to receive the added service event.

This came as a surprise, go I Googled a while, and came up short. So I was wondering if you had some words of widom for me on this ?

Kind Regards

Mark



Attachment: bundleA_1.0.0.jar
Description: application/vnd.osgi.bundle

Attachment: bundleB_1.0.0.jar
Description: application/vnd.osgi.bundle

Attachment: eclipe-projects.zip
Description: Zip archive


Back to the top