*SOLVED* OSGi 'update' command with services [message #1075194] |
Mon, 29 July 2013 01:38  |
Aaron Skelsey Messages: 4 Registered: July 2013 |
Junior Member |
|
|
Solution to problem is in reply
Hi All,
I've got an OSGi specific problem and was not sure where to post, so I thought here might be a good start and maybe someone can nudge me in the right direction?
My end goal: I'm trying to implement a platform that can dynamically update bundles using OSGi.
So far: I've made 2 bundles; a math bundle (has 2 methods that can add and multiply) and a display bundle which has a thread which runs every second, generates 2 random numbers and uses the previously mentioned math bundle to add them and multiply them (and display the result).
I'm using declarative services and as such have a component definition in the math bundle that exports a service defined by the interface IMath. Equally I have a component definition in the display bundle that subscribes (1:1 static) to a service defined by the IMath interface. I've got typical debug messages on each stage of startup / shutdown of each component.
When the project starts up I'd typically see:
Quote:
Starting up Math...
Starting up Display...
Running the Display thread...
then every second I will see the display thread doing calculations. In addition I can do the following (assuming math is bundle 1 and display is bundle 2).
Quote:
stop 1
Stopping the Display thread...
Display bundle has been shut down.
Math bundle has been shut down
start 1
Starting up Math...
Starting up Display...
Running the Display thread...
The problem: So far so good right? Everything is going great until I try to use the 'update' command. In this case I want to update the math bundle as I made an error in the multiply calculation.
Quote:
update 1
Stopping the Display thread...
Display bundle has been shut down.
Math bundle has been shut down
Starting up Math...
What the? why didn't ds call my startup method to restart the display bundle? I also tried updating the display bundle and it seems to work fine. I get the feeling that if you update a bundle it will restart, but any bundles that subscribe to a service from the updated bundle will just sit in limbo.
To make things worse if I stop and start the display bundle it STILL doesn't start up.
I'm fairly sure that I'm looking at something the wrong way, so it would be nice if someone could shed some light on my problem. If someone wants source code let me know and I can attach some basic java files to demonstrate the problem.
Thanks for reading!
Aaron
[Updated on: Mon, 29 July 2013 23:24] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02829 seconds